Skip to content

Add Interaction overriding to MouseArea#2207

Merged
hecrj merged 6 commits into
iced-rs:masterfrom
VAWVAW:mouse-area-interaction
Feb 7, 2024
Merged

Add Interaction overriding to MouseArea#2207
hecrj merged 6 commits into
iced-rs:masterfrom
VAWVAW:mouse-area-interaction

Conversation

@VAWVAW

@VAWVAW VAWVAW commented Jan 20, 2024

Copy link
Copy Markdown
Contributor

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

@hecrj hecrj left a comment

Copy link
Copy Markdown
Member

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
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