Skip to content

MouseArea widget#1594

Merged
hecrj merged 10 commits into
iced-rs:masterfrom
mmstick:listener
Apr 13, 2023
Merged

MouseArea widget#1594
hecrj merged 10 commits into
iced-rs:masterfrom
mmstick:listener

Conversation

@mmstick

@mmstick mmstick commented Dec 12, 2022

Copy link
Copy Markdown
Contributor

Implements iced-rs/rfcs#12

Run example with cargo run --release -p headerbar

Not a breaking change

@ErnWong

ErnWong commented Jan 8, 2023

Copy link
Copy Markdown

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

Comment thread native/src/widget/mouse_listener.rs Outdated
}
}

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

@IohannRabeson IohannRabeson Mar 7, 2023

Copy link
Copy Markdown

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
hecrj added 2 commits April 13, 2023 06:50
These need continuity guarantees (e.g. mandatory widget id), which we
don't have yet!

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

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