Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow number inputs to be clicked and held #9462

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

derekthesnake
Copy link

This allows for the up/down buttons on number inputs to increment the values continually when they are held.

I migrated the click logic to a subfunction, and made the click function call itself every 250ms until the button is no longer held. It tracks the state by adding an HTML attribute to the buttons while they are held down.

This passes all tests and linting in GitHub Actions.

Addresses #8816.

@Zaczero
Copy link
Contributor

Zaczero commented Jan 24, 2023

Cool idea, I think the first delay should be slightly longer, e.g: 500ms, 250ms, 250ms, ….

I believe a solution using setInterval and clearInterval would be much cleaner and easier to follow:

setInterval(click_func, 250, d3_event, d)

If not, consider putting the recursive call after this line (for optimization):
https://github.com/openstreetmap/iD/pull/9462/files#diff-20bad07a0a50747d3c088cd4cfd32014b21edec39c11f9c71998bb0f46ef876cR92.

And don't make a proxy function just to pass the arguments, you can do it natively.

@SharanRP SharanRP mentioned this pull request Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants