Skip to content

Fix/zoom wheel delta scaling#35

Merged
Ni55aN merged 2 commits into
mainfrom
fix/zoom-wheel-delta-scaling
Jul 8, 2026
Merged

Fix/zoom wheel delta scaling#35
Ni55aN merged 2 commits into
mainfrom
fix/zoom-wheel-delta-scaling

Conversation

@Ni55aN

@Ni55aN Ni55aN commented Jul 7, 2026

Copy link
Copy Markdown
Member

Description

Fixes jitter when zooming with a touchpad pinch while zoom restrictions are enabled (#31).
After #32, wheel zoom used Math.sign(deltaY) only — any non-zero deltaY triggered a full ±intensity step. Touchpad pinch sends small fractional values (e.g. 0.01–3), so each micro-movement caused a full zoom step and visible jitter at min/max zoom bounds.
This PR:

  • normalizes deltaY via deltaMode (PIXEL / LINE ×8 / PAGE ×24) in zoom-wheel.ts
  • applies proportional zoom with a cap at intensity (one mouse wheel click ≈ one step)
  • skips deltaY === 0 (gesture end / horizontal wheel)
  • adds unit tests (zoom-wheel.test.ts) and handler tests (zoom.test.ts) covering mouse, touchpad, and edge cases
    Mouse behavior is unchanged: large wheel deltas (Chrome ~120px, Firefox 1 line) still produce ±intensity per click.
    Also includes a separate commit with lint auto-fixes (style: apply lint auto-fixes) and adds npm test script.

Related Issues

#31

Checklist

Additional Notes

Ni55aN and others added 2 commits July 7, 2026 20:10
Remove stale eslint-disable comments and fix void-expression
warnings from rete lint --fix.

Co-authored-by: Cursor <cursoragent@cursor.com>
Scale wheel input by deltaMode, cap steps at intensity to preserve mouse
wheel behavior, and skip zero deltas. Add zoom unit and handler tests.

Fixes #31

Co-authored-by: Cursor <cursoragent@cursor.com>
@Ni55aN Ni55aN merged commit 9f7a3bb into main Jul 8, 2026
3 of 4 checks passed
@rete-js

rete-js Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 2.2.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@rete-js rete-js Bot added the released label Jul 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant