mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Updated mouse wheel zooming to use WindowEvent
Former-commit-id: fabe382516fd65eb76043b7d6ada87cf20f53590
This commit is contained in:
@ -128,7 +128,7 @@ impl Scene {
|
|||||||
},
|
},
|
||||||
// Zoom the camera when a zoom event occurs
|
// Zoom the camera when a zoom event occurs
|
||||||
Event::Zoom(delta) => {
|
Event::Zoom(delta) => {
|
||||||
self.camera.zoom_by(delta);
|
self.camera.zoom_by(-delta);
|
||||||
true
|
true
|
||||||
},
|
},
|
||||||
// All other events are unhandled
|
// All other events are unhandled
|
||||||
|
@ -92,15 +92,15 @@ impl Window {
|
|||||||
}),
|
}),
|
||||||
_ => {},
|
_ => {},
|
||||||
},
|
},
|
||||||
|
glutin::WindowEvent::MouseWheel {
|
||||||
|
delta: glutin::MouseScrollDelta::LineDelta(_x, y),
|
||||||
|
..
|
||||||
|
} => events.push(Event::Zoom(y as f32)),
|
||||||
_ => {},
|
_ => {},
|
||||||
},
|
},
|
||||||
glutin::Event::DeviceEvent { event, .. } => match event {
|
glutin::Event::DeviceEvent { event, .. } => match event {
|
||||||
glutin::DeviceEvent::MouseMotion { delta: (dx, dy), .. } if cursor_grabbed =>
|
glutin::DeviceEvent::MouseMotion { delta: (dx, dy), .. } if cursor_grabbed =>
|
||||||
events.push(Event::CursorPan(Vec2::new(dx as f32, dy as f32))),
|
events.push(Event::CursorPan(Vec2::new(dx as f32, dy as f32))),
|
||||||
glutin::DeviceEvent::MouseWheel {
|
|
||||||
delta: glutin::MouseScrollDelta::LineDelta(_x, y),
|
|
||||||
..
|
|
||||||
} if cursor_grabbed => events.push(Event::Zoom(y as f32)),
|
|
||||||
_ => {},
|
_ => {},
|
||||||
},
|
},
|
||||||
_ => {},
|
_ => {},
|
||||||
|
Reference in New Issue
Block a user