enable horizontal scroll on timeline #535
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 holdingctrl
, on a vertical scroll event it should zoom in or out depending on the sign of the value forevent.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 forevent.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.