Navigation Menu

Skip to content

Commit

Permalink
update mouse position when receiving mouse wheel events
Browse files Browse the repository at this point in the history
  • Loading branch information
gterzian authored and mbrubeck committed Feb 1, 2017
1 parent d161f6e commit 7717e83
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
14 changes: 7 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ports/glutin/Cargo.toml
Expand Up @@ -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"}
Expand Down
7 changes: 6 additions & 1 deletion ports/glutin/window.rs
Expand Up @@ -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);
},
Expand Down

0 comments on commit 7717e83

Please sign in to comment.