Skip to content

feat(zoom): add fScrollPan and fPinchStep inputs to FZoomDirective#313

Merged
siarheihuzarevich merged 1 commit into
Foblex:mainfrom
yaroslavyushchenko:feature/scroll-pan-pinch-step
Jul 5, 2026
Merged

feat(zoom): add fScrollPan and fPinchStep inputs to FZoomDirective#313
siarheihuzarevich merged 1 commit into
Foblex:mainfrom
yaroslavyushchenko:feature/scroll-pan-pinch-step

Conversation

@yaroslavyushchenko

Copy link
Copy Markdown
Contributor

Summary

  • fScrollPan: boolean — when enabled, two-finger scroll on a trackpad pans the canvas instead of zooming. Opt-in, default false.
  • fPinchStep: number — separate zoom step for pinch gestures. When 0, falls back to fZoomStep. Default 0.

Related Issue

Closes #312

Problem

On MacBook and other precision trackpads, two-finger scroll triggers zoom instead of panning the canvas. There was also no way to tune pinch-to-zoom speed independently from mouse wheel zoom — both shared fZoomStep, but pinch gestures have very different sensitivity.

Scope

  • libs/f-flow/src/f-zoom/f-zoom.directive.ts — two new inputs, wheel routing logic
  • libs/f-flow/src/f-zoom/wheel-zoom.utils.ts — new isTrackpadScrollEvent utility
  • libs/f-flow/src/f-zoom/wheel-zoom.utils.spec.ts — unit tests
  • libs/f-examples/extensions/zoom/ — checkbox added to the live example
  • apps/f-flow-portal/public/ — docs updated

Public API Impact

Two new opt-in inputs on FZoomDirective. No breaking changes. Default behavior is unchanged.

Input Type Default
fScrollPan boolean false
fPinchStep number 0

Documentation and Examples

  • f-zoom-directive.md — new inputs documented
  • llms-full.txt and llms.txt — updated
  • Zoom example — "Two-finger pan" checkbox added

Testing

All 140 existing tests pass. New unit test added for isTrackpadScrollEvent covering pixel-mode detection and modifier key exclusions.

@siarheihuzarevich siarheihuzarevich merged commit 9de4c21 into Foblex:main Jul 5, 2026
siarheihuzarevich added a commit that referenced this pull request Jul 5, 2026
…croll-pan

PR #313 by @yaroslavyushchenko independently implemented scroll-pan and
fPinchStep against the pre-v19 zoom directive. It is merged to main so the
contribution stays in history; this merge resolves every touched file to
the v19 implementation, which covers the same behavior through the control
scheme with deltaMode-normalized pan deltas and the mediator scroll path.
Credited in the changelog.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@siarheihuzarevich siarheihuzarevich self-assigned this Jul 5, 2026
@siarheihuzarevich

siarheihuzarevich commented Jul 5, 2026

Copy link
Copy Markdown
Member

Merged - thank you for this one 🙌

Quick heads-up so the follow-up doesn't surprise you: while this PR was sitting in the queue, the v19 branch (#314) grew a control-scheme feature that ended up covering the same ground - scrollPan became part of the gesture mapping (provideFFlow(withControlScheme(...)), with a Miro-like preset), and fPinchStep landed there in exactly the shape you proposed, same default and fallback.

So in the v19 merge your implementation gets unified into the scheme-driven one - the behavior survives, the code path changes:

  • scroll-pan routes through the mediator (ScrollCanvasRequest) instead of setting the canvas position directly
  • pan deltas are deltaMode-normalized, so line-mode wheels (Firefox mice) pan at a usable speed instead of ~3px per tick
  • isTrackpadScrollEvent goes away - Chrome reports plain mouse wheels as pixel-mode too, so trackpad detection by deltaMode only holds on Firefox; the scheme semantics ("wheel pans, Ctrl/Cmd+wheel or pinch zooms") are deterministic across browsers

You're credited in the v19 changelog for proposing both features. If the per-instance [fScrollPan] input still feels needed on top of the scheme (e.g. toggling one canvas from a template), open an issue - after v19 it would be a ~15 line PR that fits the "input overrides scheme" precedence rule.

Appreciate the tests and the clean scope of this PR - if you feel like picking up something else in v19, PRs are always welcome.

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]: fScrollPan and fPinchStep inputs for better trackpad support

2 participants