Skip to content

Commit

Permalink
fix: Fix broken button
Browse files Browse the repository at this point in the history
  • Loading branch information
tphbrok committed Jul 14, 2024
1 parent 2e02c65 commit 1e47750
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/editor/button.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ impl View for Button {
}

fn event(&mut self, cx: &mut EventContext, event: &mut Event) {
event.map(|window_event, _meta| match window_event {
event.map(|window_event, meta| match window_event {
WindowEvent::ActionRequest(action) => match action.action {
Action::Default => {
if let Some(callback) = &self.action {
Expand All @@ -48,6 +48,14 @@ impl View for Button {
_ => {}
},

WindowEvent::Press { .. } => {
if meta.target == cx.current() {
if let Some(callback) = &self.action {
(callback)(cx);
}
}
}

WindowEvent::MouseUp(button) if *button == MouseButton::Left => {
cx.release();
}
Expand Down

0 comments on commit 1e47750

Please sign in to comment.