Skip to content

feat: add suppressInternalGestures flag to disable built-in input#10

Draft
F1orian wants to merge 1 commit into
vento007:mainfrom
F1orian:feat/suppress-internal-gestures
Draft

feat: add suppressInternalGestures flag to disable built-in input#10
F1orian wants to merge 1 commit into
vento007:mainfrom
F1orian:feat/suppress-internal-gestures

Conversation

@F1orian
Copy link
Copy Markdown

@F1orian F1orian commented May 31, 2026

What

Adds an explicit bool suppressInternalGestures (default false) to CanvasKit. When true, the widget builds no internal pan/pinch GestureDetector and ignores pointer-signal (mouse-wheel) zoom — regardless of interactionMode or gestureOverlayBuilder.

Why

Today the only way to fully suppress canvas_kit's own input handling is to be in programmatic mode and pass a non-null gestureOverlayBuilder. But apps that own all input from their own gesture layer — stacked as a sibling above CanvasKit so it can hit-test in world space and win pointers over the items — don't actually want canvas_kit's gestureOverlayBuilder, because that builder's result is composited below the item children (it can't host a layer that must hit-test above tiles).

So those apps currently pass an empty gestureOverlayBuilder: (_, _) => SizedBox.shrink() purely to flip the internal switch. That's a non-obvious idiom — a builder's mere presence silently changes gesture behavior, with no compile-time or runtime signal of intent.

This flag makes "the embedding app owns all input" explicit and self-documenting, and decouples it from "I'm supplying an overlay."

Behavior / compatibility

  • Default falseno change for existing callers.
  • The previous implicit suppression (programmatic + non-null gestureOverlayBuilder) still applies, so existing code keeps working unchanged.
  • Both the internal GestureDetector and the onPointerSignal wheel-zoom are gated on the same computed condition.

Tests

Adds the package's first test/ directory (suppress_internal_gestures_test.dart):

  • control: a default CanvasKit pans on drag (proves the harness drives the gesture, so the assertion below isn't vacuous);
  • suppressed: with suppressInternalGestures: true, the library does not move the camera on drag.

Notes

The diff is intentionally minimal and additive: one field, one constructor parameter, and two one-line gate changes in build(). Happy to adjust the name (suppressInternalGestures vs. e.g. handleInput: false) to match your preference.

Adds an explicit `suppressInternalGestures` bool to CanvasKit. When true,
the widget builds no internal pan/pinch GestureDetector and ignores
pointer-signal (mouse-wheel) zoom, regardless of interactionMode or
gestureOverlayBuilder.

This replaces the implicit idiom of passing an empty
`gestureOverlayBuilder: (_, _) => SizedBox.shrink()` purely to suppress
the library's own gestures when the embedding app owns all input from a
sibling layer stacked above CanvasKit. Backward compatible: defaults to
false, and the previous programmatic+overlay suppression still applies.

Also adds the package's first test/ directory
(suppress_internal_gestures_test.dart) covering both the control
(pans by default) and suppressed (no camera movement) paths.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vento007
Copy link
Copy Markdown
Owner

vento007 commented Jun 1, 2026

noticed.. will not get time before the weekend to check your PRs, thx :)

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