Skip to content

Zoom only on vertical wheel movement - #109

Open
erseco wants to merge 1 commit into
drichard:masterfrom
exelearning:upstream/fix-horizontal-wheel-zoom
Open

erseco wants to merge 1 commit into
drichard:masterfrom
exelearning:upstream/fix-horizontal-wheel-zoom

Conversation

@erseco

@erseco erseco commented Sep 19, 2026

Copy link
Copy Markdown

Summary

Ignore horizontal-only wheel gestures when zooming the mind map.

The vendored jquery.mousewheel 3.0.4 passes both horizontal and vertical deltas to the handler. The current code uses the generic delta, which can represent horizontal movement when there is no vertical movement, causing sideways trackpad gestures to zoom the map.

This change uses the vertical deltaY directly and ignores the event when there is no vertical movement.

No dependency or architectural changes are involved.

Behaviour

Before:

  • horizontal scroll right → zoom
  • horizontal scroll left → zoom
  • vertical scroll → zoom

After:

  • horizontal scroll → no zoom
  • vertical scroll → zoom as before

Validation

npm ci && npm run build succeeds with the project's existing dependencies.

Comment thread src/js/CanvasView.js Outdated
//
// Zoom is a vertical gesture, but the plugin reports the horizontal delta as
// the generic delta when there is no vertical movement, so a sideways swipe
// would zoom. Prefer deltaY, falling back to delta for older plugin builds

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand the fallback because we vendor the library, don't we? So we are in control of the version.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right. I added the fallback defensively to keep the change compatible with other plugin versions, but that's unnecessary here since mindmaps vendors jquery.mousewheel 3.0.4 and that version always passes deltaY as the fourth argument.

I've simplified it to use deltaY directly and ignore the event when it is zero. Thanks for catching that.

jquery.mousewheel reports the horizontal delta as the generic delta when
there is no vertical movement, so a sideways two-finger trackpad gesture
zoomed the map. The vendored jquery.mousewheel 3.0.4 always passes the
vertical delta as the fourth handler argument, so use it directly and
ignore the event when there is no vertical movement.
@erseco
erseco force-pushed the upstream/fix-horizontal-wheel-zoom branch from ee80c2f to c01c205 Compare September 19, 2026 12:13

This branch has not been deployed

No deployments
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