Skip to content

fix: Mac trackpad horizontal scroll incorrectly triggers zoom in Agent Canvas (#1211)#1220

Merged
bytecii merged 9 commits intoeigent-ai:mainfrom
spider-yamet:feat/MAC-Trackpad-horizontal-scrolling
Feb 12, 2026
Merged

fix: Mac trackpad horizontal scroll incorrectly triggers zoom in Agent Canvas (#1211)#1220
bytecii merged 9 commits intoeigent-ai:mainfrom
spider-yamet:feat/MAC-Trackpad-horizontal-scrolling

Conversation

@spider-yamet
Copy link
Contributor

Summary

Fixes #1211 — On Mac trackpads, two-finger horizontal scrolling in the Agent Canvas (Workflow) was triggering zoom instead of horizontal pan.

Root cause

  • The wheel handler only used deltaY (vertical scroll) to control horizontal pan.
  • Horizontal trackpad scroll uses deltaX, which was ignored.
  • Pinch gestures send ctrlKey: true, which was not handled, so the browser default zoom could run.

Solution

  • Use deltaX for horizontal trackpad scroll (two-finger swipe left/right).
  • Keep deltaY for vertical scroll mapped to horizontal pan (mouse wheel / trackpad vertical swipe).
  • Add ctrlKey check to prevent pinch-to-zoom when zoom is disabled in non-edit mode.

Changes

  • Extracted wheel logic to workflowWheelHandler.ts for clarity and testability.
  • Updated WorkFlow/index.tsx to use createWorkflowWheelHandler.
  • Added unit tests for the wheel handler (13 cases).

Testing

  • Unit tests pass: npm run test -- test/unit/components/WorkFlow/workflowWheelHandler.test.ts
  • Recommended manual check on a Mac with trackpad: horizontal swipe pans, pinch does not zoom in normal mode.

Copy link
Collaborator

@bytecii bytecii left a comment

Choose a reason for hiding this comment

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

In general LGTM. Left one comment

if (isEditMode) return;

// Mac trackpad pinch-to-zoom sends ctrlKey=true — prevent browser zoom when zoom is disabled
if (e.ctrlKey) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Will this be something can influence the windows user? For example windows user expect the ctrl + mouse to zoom the page?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this will affect Windows users: Ctrl + mouse wheel zoom will be blocked over the Agent Canvas. The ctrlKey check was added to prevent Mac trackpad pinch zoom, but it also blocks Windows Ctrl+wheel zoom.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe we can add some comments here to help to track for future changes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@bytecii I added comment for this. Regards

@spider-yamet
Copy link
Contributor Author

@bytecii @Wendong-Fan could you please check the the PR status?

@bytecii bytecii merged commit d5a6c39 into eigent-ai:main Feb 12, 2026
7 checks passed
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.

[Feature Request] MAC Trackpad horizontal scrolling incorrectly triggers zoom in Agent Canvas

2 participants