Skip to content

feat: Support allowsMultiPointerDrag on DragCallbacks - #4033

Merged
spydon merged 3 commits into
mainfrom
luan.multi-fingering
Aug 31, 2026
Merged

feat: Support allowsMultiPointerDrag on DragCallbacks#4033
spydon merged 3 commits into
mainfrom
luan.multi-fingering

Conversation

@luanpotter

Copy link
Copy Markdown
Member

Description

Add support for a allowsMultiPointerDrag on DragCallbacks, for easy of use for components that would break under multiple concurrent drags.

When a drag controls the component itself, or a camera for panning, initiating a multi-fingered interaction might cause an elated state on the component, which might or might not be desirable depending on circumstances. Many existing examples were fixed as part of the new system migration (#4028; as per requested by Copilot), but all with ad-hoc code that Flame could vastly simplify. Note that is is not to discourage two-, three- or even five-fingered manipulations; but rather just to empower users to choose what feels best for their application.

Checklist

  • I have followed the Contributor Guide when preparing my PR.
  • I have updated/added tests for ALL new/updated/fixed functionality.
  • I have updated/added relevant documentation in docs and added dartdoc comments with ///.
  • I have updated/added relevant examples in examples or docs.

Breaking Change?

  • Yes, this PR is a breaking change.
  • No, this PR is not a breaking change.

@luanpotter
luanpotter force-pushed the luan.multi-fingering branch from 71619f3 to 3f0bc8d Compare August 30, 2026 20:28
@luanpotter
luanpotter marked this pull request as ready for review August 30, 2026 20:28
@luanpotter
luanpotter requested review from spydon and a balanced review from Copilot August 30, 2026 20:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds opt-in single-pointer drag handling to simplify components managing shared state.

Changes:

  • Adds allowsMultiPointerDrag with propagation and scale-event compatibility.
  • Adds comprehensive drag-dispatch tests and documentation.
  • Migrates three examples from manual pointer tracking.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
drag_callbacks.dart Defines the new public option.
multi_drag_scale_dispatcher.dart Gates concurrent drag starts.
drag_callbacks_test.dart Tests gating, cleanup, propagation, and scaling.
drag_events.md Documents usage and behavior.
game.dart Simplifies ship drag control.
particles_interactive_example.dart Simplifies emitter drag control.
camera_component_example.dart Simplifies magnifier drag control.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread packages/flame/lib/src/events/callbacks/drag_callbacks.dart Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@spydon
spydon merged commit 0b60895 into main Aug 31, 2026
8 checks passed
@spydon
spydon deleted the luan.multi-fingering branch August 31, 2026 15:02
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.

3 participants