Merge branch 'master' into 'master'

Updated mouse wheel zooming to use WindowEvent

See merge request veloren/veloren!7

Former-commit-id: 04b7ffd2cabf7a771729c90d1ae07e89783b7417
This commit is contained in:
Joshua Barretto 2019-04-12 11:11:52 +00:00
commit 29d6cb5127
2 changed files with 10 additions and 13 deletions

View File

@ -124,7 +124,7 @@ impl Scene {
},
// Zoom the camera when a zoom event occurs
Event::Zoom(delta) => {
self.camera.zoom_by(delta);
self.camera.zoom_by(-delta);
true
},
// All other events are unhandled

View File

@ -113,21 +113,18 @@ impl Window {
},
_ => {}
},
_ => {}
},
glutin::Event::DeviceEvent { event, .. } => match event {
glutin::DeviceEvent::MouseMotion {
delta: (dx, dy), ..
} if cursor_grabbed => {
events.push(Event::CursorPan(Vec2::new(dx as f32, dy as f32)))
}
glutin::DeviceEvent::MouseWheel {
glutin::WindowEvent::MouseWheel {
delta: glutin::MouseScrollDelta::LineDelta(_x, y),
..
} if cursor_grabbed => events.push(Event::Zoom(y as f32)),
_ => {}
} => events.push(Event::Zoom(y as f32)),
_ => {},
},
_ => {}
glutin::Event::DeviceEvent { event, .. } => match event {
glutin::DeviceEvent::MouseMotion { delta: (dx, dy), .. } if cursor_grabbed =>
events.push(Event::CursorPan(Vec2::new(dx as f32, dy as f32))),
_ => {},
},
_ => {},
}
});
events