Introduce MouseEventHandler

Still need to give elements the ability to re-render their parent view. Once that is in place, I think we can implement hoverable close tab buttons.
This commit is contained in:
Nathan Sobo
2021-04-26 21:52:18 -06:00
parent a47b0b4ca6
commit fc4b7e2a2a
5 changed files with 138 additions and 3 deletions
+3
View File
@@ -21,4 +21,7 @@ pub enum Event {
LeftMouseDragged {
position: Vector2F,
},
MouseMoved {
position: Vector2F,
},
}
+6
View File
@@ -108,6 +108,12 @@ impl Event {
),
precise: native_event.hasPreciseScrollingDeltas() == YES,
}),
NSEventType::NSMouseMoved => window_height.map(|window_height| Self::MouseMoved {
position: vec2f(
native_event.locationInWindow().x as f32,
window_height - native_event.locationInWindow().y as f32,
),
}),
_ => None,
}
}