Skip to content

Conversation

@enwi
Copy link

@enwi enwi commented Sep 5, 2025

This pull request adds support for distinguishing between primary and secondary button interactions in chart touch events. The main changes involve creating special secondary event classes and wiring up the appropriate gesture recognizer callbacks to handle secondary button events.

Touch event model enhancements:

  • Added secondary touch event classes (FlTapDownSecondaryEvent, FlTapCancelSecondaryEvent, FlTapUpSecondaryEvent, FlLongPressSecondaryStart, FlLongPressMoveSecondaryUpdate, FlLongPressSecondaryEnd) in fl_touch_event.dart to indicate if the event was triggered by a secondary button.

Gesture recognizer integration:

  • Updated render_base_chart.dart to handle secondary tap and long press gestures by wiring up the corresponding gesture recognizer callbacks.

These changes enable the chart to differentiate between primary and secondary pointer interactions, which is useful for supporting right-click or other alternate input methods.

@imaNNeo
Copy link
Owner

imaNNeo commented Oct 25, 2025

Hi Owen,
Thanks for your contribution.

I think it's better to define different event types for the secondary events (instead of adding a flag inside the current events).
And the reason is the fact that it affects the current logic that users have. Suppose that they implemented a logic that only accepts the primary tap. After updating to the new version, they also support the secondary tap. (I know they can update their logic to check if it is a primary tap or not, but that's not backward compatible)

So I just suggest defining new event types for secondary events, then anyone can support the secondary button, and the current implementation remains untouched.

Thanks!

@enwi
Copy link
Author

enwi commented Oct 27, 2025

Hey @imaNNeo I have updated the PR as you suggested 🙂

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