mirror of
https://github.com/servo/servo.git
synced 2025-09-10 23:18:20 +01:00
update mouse position when receiving mouse wheel events
This commit is contained in:
parent
d161f6ec44
commit
7717e83206
3 changed files with 14 additions and 9 deletions
|
@ -17,7 +17,7 @@ log = "0.3.5"
|
|||
msg = {path = "../../components/msg"}
|
||||
net_traits = {path = "../../components/net_traits"}
|
||||
script_traits = {path = "../../components/script_traits"}
|
||||
servo-glutin = "0.6"
|
||||
servo-glutin = "0.7"
|
||||
servo_geometry = {path = "../../components/geometry"}
|
||||
servo_config = {path = "../../components/config"}
|
||||
servo_url = {path = "../../components/url"}
|
||||
|
|
|
@ -421,12 +421,17 @@ impl Window {
|
|||
self.event_queue.borrow_mut().push(
|
||||
WindowEvent::MouseWindowMoveEventClass(TypedPoint2D::new(x as f32, y as f32)));
|
||||
}
|
||||
Event::MouseWheel(delta, phase) => {
|
||||
Event::MouseWheel(delta, phase, pos) => {
|
||||
let (dx, dy) = match delta {
|
||||
MouseScrollDelta::LineDelta(dx, dy) => (dx, dy * LINE_HEIGHT),
|
||||
MouseScrollDelta::PixelDelta(dx, dy) => (dx, dy),
|
||||
};
|
||||
let scroll_location = ScrollLocation::Delta(TypedPoint2D::new(dx, dy));
|
||||
if let Some((x, y)) = pos {
|
||||
self.mouse_pos.set(Point2D::new(x, y));
|
||||
self.event_queue.borrow_mut().push(
|
||||
WindowEvent::MouseWindowMoveEventClass(TypedPoint2D::new(x as f32, y as f32)));
|
||||
};
|
||||
let phase = glutin_phase_to_touch_event_type(phase);
|
||||
self.scroll_window(scroll_location, phase);
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue