I am thinking about an optional flag for the keyNav. Especially when navigating through the helix items using the arrow keys, it feels like you move 5 / 300 items per second. The reason seems to be that the keydown event does not fire more often in case you keep a key pressed.
My current idea: save the last x onKeyDown events (key & timestamp). In case the same key triggers x times within the time interval y, fire the event handler again with a delay. E.g. the app worker gets the event every 200ms, fire it again with a 100ms delay. If it keeps firing "longer", add 3 delayed handler calls (50, 100, 150ms). OnKeyUp should cancel all timeout calls to stop at the current position.
We could further polish this in case we keep track of the current FPS rate and ensure there is max 1 movement within 1 animation frame (follow up ticket).
Thoughts?
I am thinking about an optional flag for the keyNav. Especially when navigating through the helix items using the arrow keys, it feels like you move 5 / 300 items per second. The reason seems to be that the keydown event does not fire more often in case you keep a key pressed.
My current idea: save the last x onKeyDown events (key & timestamp). In case the same key triggers x times within the time interval y, fire the event handler again with a delay. E.g. the app worker gets the event every 200ms, fire it again with a 100ms delay. If it keeps firing "longer", add 3 delayed handler calls (50, 100, 150ms). OnKeyUp should cancel all timeout calls to stop at the current position.
We could further polish this in case we keep track of the current FPS rate and ensure there is max 1 movement within 1 animation frame (follow up ticket).
Thoughts?