Skip to content

Commit

Permalink
Handle MouseLeft event (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
longmathemagician authored Dec 11, 2022
1 parent e4510ab commit bf7d20e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/app_main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,11 @@ where
self.handle.invalidate();
}

fn mouse_leave(&mut self) {
self.app.window_event(RawEvent::MouseLeft());
self.handle.invalidate();
}

fn size(&mut self, size: Size) {
self.app.size(size);
}
Expand Down
9 changes: 9 additions & 0 deletions src/widget/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,15 @@ impl Pod {
false
}
}
RawEvent::MouseLeft() => {
let hot_changed =
Pod::set_hot_state(&mut self.widget, &mut self.state, cx.cx_state, rect, None);
if had_active || hot_changed {
true
} else {
false
}
}
};
if recurse {
let mut inner_cx = EventCx {
Expand Down
1 change: 1 addition & 0 deletions src/widget/raw_event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ pub enum RawEvent {
MouseUp(MouseEvent),
MouseMove(MouseEvent),
MouseWheel(MouseEvent),
MouseLeft(),
}

#[derive(Debug, Clone)]
Expand Down

0 comments on commit bf7d20e

Please sign in to comment.