Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Interaction overriding to MouseArea #2207

Merged
merged 6 commits into from
Feb 7, 2024

Conversation

VAWVAW
Copy link
Contributor

@VAWVAW VAWVAW commented Jan 20, 2024

The widget MouseArea allows to create button-like behavior but gives more control than Button. Currently there is no obvious way to change the mouse Interaction with the widget. I feel like MouseArea would be the most straightforward place to implement this.

This change adds the option to override the Interaction of the contained widget and set a custom one using the mouse_interaction callback.

@hecrj hecrj added this to the 0.12 milestone Feb 3, 2024
@hecrj hecrj added feature New feature or request widget addition labels Feb 3, 2024
@VAWVAW VAWVAW force-pushed the mouse-area-interaction branch from 624bc8c to 75a8126 Compare February 4, 2024 21:54
VAWVAW and others added 2 commits February 7, 2024 11:56
Add the ability to use a custom `iced::mouse::Interaction` for a
`iced::widget::MouseArea`.
@hecrj hecrj force-pushed the mouse-area-interaction branch from 75a8126 to d756a92 Compare February 7, 2024 11:01
@hecrj hecrj force-pushed the mouse-area-interaction branch from 7ef598e to d5a3e59 Compare February 7, 2024 11:06
Copy link
Member

@hecrj hecrj left a comment

Choose a reason for hiding this comment

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

Thanks! 🎉

Made some changes to ensure the content interaction has priority over the MouseArea one, since the content event logic takes priority.

@hecrj hecrj enabled auto-merge February 7, 2024 11:08
@hecrj hecrj merged commit bdd1891 into iced-rs:master Feb 7, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addition feature New feature or request widget
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants