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

enable horizontal scroll on timeline #535

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

wis
Copy link

@wis wis commented Jan 14, 2024

right now when you scroll horizontally, to the left or right, it zooms on the timeline and does not scroll the timeline. it should scroll the timeline when you scroll horizontally.

option used, horizontalScroll?: boolean:
https://github.com/visjs/vis-timeline/blob/698f7ebfbe0ed93c6b4b1928ea9a39c5182d275f/types/index.d.ts#L268

the option's usage in the vis-timeline repo:
https://github.com/search?q=repo%3Avisjs%2Fvis-timeline%20horizontalScroll&type=code

edit: after searching existing PRs after submitting this PR, it appears there's an existing PR for this, #237, I am not sure why it has not been merged yet, I think it is the hesitancy to change the UI interaction for the zoom behavior, I don't understand why is holding ctrl discussed in that PR? I don't think it should require holding ctrl, on a vertical scroll event it should zoom in or out depending on the sign of the value for event.deltaY, whether it is positive or negative, and on a horizontal scroll event it should scroll left or right, depending on the sign of the value for event.deltaX, whether it is positive or negative. it should not do the same thing, zoom in or out, on BOTH vertical and horizontal scrolling, that's redundant.

(it appears the library supports enabling this behavior with options):
https://github.com/visjs/vis-timeline/blob/698f7ebfbe0ed93c6b4b1928ea9a39c5182d275f/lib/timeline/Core.js#L258

FYI: horizontal scroll is a native event on the OS level, there are mouses/?mice? that come with a horizontal scroll wheel, laptops also send a horizontal scroll event when swiping two fingers horizontally on the touchpad. also some applications, for example: browsers, treat the vertical scroll event as a horizontal scroll event when shift is held down while scrolling vertically.

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.

1 participant