Call OnPress::get only when button is pressed
This commit is contained in:
parent
8295b231df
commit
2cab4e6ddb
1 changed files with 2 additions and 2 deletions
|
|
@ -315,7 +315,7 @@ where
|
||||||
}
|
}
|
||||||
Event::Mouse(mouse::Event::ButtonReleased(mouse::Button::Left))
|
Event::Mouse(mouse::Event::ButtonReleased(mouse::Button::Left))
|
||||||
| Event::Touch(touch::Event::FingerLifted { .. }) => {
|
| Event::Touch(touch::Event::FingerLifted { .. }) => {
|
||||||
if let Some(on_press) = self.on_press.as_ref().map(OnPress::get)
|
if let Some(on_press) = &self.on_press
|
||||||
{
|
{
|
||||||
let state = tree.state.downcast_mut::<State>();
|
let state = tree.state.downcast_mut::<State>();
|
||||||
|
|
||||||
|
|
@ -325,7 +325,7 @@ where
|
||||||
let bounds = layout.bounds();
|
let bounds = layout.bounds();
|
||||||
|
|
||||||
if cursor.is_over(bounds) {
|
if cursor.is_over(bounds) {
|
||||||
shell.publish(on_press);
|
shell.publish(on_press.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
shell.capture_event();
|
shell.capture_event();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue