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

MouseArea widget #1594

Merged
merged 10 commits into from
Apr 13, 2023
Merged

MouseArea widget #1594

merged 10 commits into from
Apr 13, 2023

Conversation

mmstick
Copy link
Contributor

@mmstick mmstick commented Dec 12, 2022

Implements iced-rs/rfcs#12

Run example with cargo run --release -p headerbar

Not a breaking change

@ErnWong
Copy link

ErnWong commented Jan 8, 2023

Hi! Just a heads up that with the current implementation it looks like on_mouse_enter and on_mouse_exit doesn't react to layout changes if the mouse doesn't move.

Screen.Recording.2023-01-08.at.8.56.05.PM.mov

(Thank you @13r0ck for pointing out this scenario over on Discord for my mouse_area prototype, which also suffers from this problem).

}
}

if let Some(message) = widget.on_right_press.clone() {
Copy link

@IohannRabeson IohannRabeson Mar 7, 2023

Choose a reason for hiding this comment

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

Hi! You could clone the message only if its published.

@hecrj hecrj added feature New feature or request widget labels Apr 12, 2023
@hecrj hecrj added this to the 0.9.0 milestone Apr 12, 2023
@hecrj hecrj changed the title feat: Add MouseListener Widget MouseArea widget Apr 13, 2023
These need continuity guarantees (e.g. mandatory widget id), which we
don't have yet!
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.

Looks good! Thanks and sorry for the wait! 🙇

I had to unfortunately remove the on_mouse_enter and on_mouse_exit events since, as others pointed out in the comments, in order to support them we would need some kind of continuity guarantees in the persistent widget tree that we currently lack. Certainly something we should revisit in the future!

In any case, I think we can merge this simplified version 🚢

@hecrj hecrj enabled auto-merge April 13, 2023 05:05
@hecrj hecrj merged commit ded88d7 into iced-rs:master Apr 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request widget
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants