Skip to content

feat: add keepChildrenMounted parameter#9

Open
F1orian wants to merge 2 commits into
vento007:mainfrom
F1orian:feat/keep-children-mounted
Open

feat: add keepChildrenMounted parameter#9
F1orian wants to merge 2 commits into
vento007:mainfrom
F1orian:feat/keep-children-mounted

Conversation

@F1orian
Copy link
Copy Markdown

@F1orian F1orian commented May 28, 2026

Summary

Adds a keepChildrenMounted parameter to CanvasKit and SimpleCanvas:

  • When true, all children stay in the widget tree regardless of viewport visibility — the app controls which items are in children, and canvas_kit skips its internal visibility culling.
  • Default is false, preserving existing behavior (off-screen children are culled).

This is useful when the app already manages which items to render (e.g. based on its own spatial index or data model) and doesn't want canvas_kit to additionally cull based on viewport bounds.

Changes

  • Added keepChildrenMounted bool parameter to CanvasKit (default false)
  • Threaded it through to SimpleCanvas
  • When enabled, skips the isVisible() check in the render loop

Test plan

  • Verified with keepChildrenMounted: false (default) — existing culling behavior unchanged
  • Verified with keepChildrenMounted: true — all children remain mounted when panning/zooming off-screen

F1orian and others added 2 commits May 22, 2026 18:47
When true, all children stay in the widget tree regardless of viewport
visibility — the app controls which items are in children, and canvas_kit
skips its internal visibility culling. Default is false (existing behavior).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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>
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.

1 participant