Skip to content

feat: Implement TertiaryTapCallbacks on new event system#3899

Draft
luanpotter wants to merge 1 commit intomainfrom
luan.tertiary
Draft

feat: Implement TertiaryTapCallbacks on new event system#3899
luanpotter wants to merge 1 commit intomainfrom
luan.tertiary

Conversation

@luanpotter
Copy link
Copy Markdown
Member

Description

Following up on our events master plan.

This adds TertiaryTapCallbacks and necessary infrastructure to make it work.

This replaces the old TertiaryTapDetector (which we can deprecate later), e.g.:

class MyGame extends FlameGame with TertiaryTapDetector {
  @override
  void onTertiaryTapDown(TapDownInfo info) {
    // game-level handling
  }
}

With TertiaryTapCallbacks following the newer patterns in flame:

class MiddleClickSquare extends RectangleComponent with TertiaryTapCallbacks {
  @override
  void onTertiaryTapDown(TertiaryTapDownEvent event) {
    // component-level handling, with hit detection
  }

  @override
  void onTertiaryTapUp(TertiaryTapUpEvent event) {
    // tertiary tap finished
  }
}

Also fixes GestureDetectorBuilder.add() to compose initializers when multiple dispatchers share the same gesture recognizer type (e.g. SecondaryTapDispatcher and TertiaryTapDispatcher both use TapGestureRecognizer). Previously the second dispatcher's initializer was silently ignored.

Also adds example, tests, and documentation.

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.

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