Merge pull request #2683 from T-256/master
Call `OnPress::get` only when button is pressed
This commit is contained in:
commit
3b2a422d5d
1 changed files with 2 additions and 3 deletions
|
|
@ -315,8 +315,7 @@ where
|
|||
}
|
||||
Event::Mouse(mouse::Event::ButtonReleased(mouse::Button::Left))
|
||||
| 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>();
|
||||
|
||||
if state.is_pressed {
|
||||
|
|
@ -325,7 +324,7 @@ where
|
|||
let bounds = layout.bounds();
|
||||
|
||||
if cursor.is_over(bounds) {
|
||||
shell.publish(on_press);
|
||||
shell.publish(on_press.get());
|
||||
}
|
||||
|
||||
shell.capture_event();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue