mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Voxygen: Fixed weird window movement caused by moving the window with the cursor grabbed (#588)
This commit is contained in:
parent
c22f9530e4
commit
4a4a106232
@ -2123,6 +2123,12 @@ impl Hud {
|
|||||||
self.force_ungrab = !state;
|
self.force_ungrab = !state;
|
||||||
true
|
true
|
||||||
},
|
},
|
||||||
|
WinEvent::Moved(_) => {
|
||||||
|
// Prevent the cursor from being grabbed while the window is being moved as this
|
||||||
|
// causes the window to move erratically
|
||||||
|
self.show.want_grab = false;
|
||||||
|
true
|
||||||
|
},
|
||||||
|
|
||||||
_ => false,
|
_ => false,
|
||||||
};
|
};
|
||||||
|
@ -162,6 +162,8 @@ pub enum Event {
|
|||||||
Close,
|
Close,
|
||||||
/// The window has been resized.
|
/// The window has been resized.
|
||||||
Resize(Vec2<u32>),
|
Resize(Vec2<u32>),
|
||||||
|
/// The window has been moved.
|
||||||
|
Moved(Vec2<u32>),
|
||||||
/// A key has been typed that corresponds to a specific character.
|
/// A key has been typed that corresponds to a specific character.
|
||||||
Char(char),
|
Char(char),
|
||||||
/// The cursor has been panned across the screen while grabbed.
|
/// The cursor has been panned across the screen while grabbed.
|
||||||
@ -552,6 +554,9 @@ impl Window {
|
|||||||
renderer.on_resize().unwrap();
|
renderer.on_resize().unwrap();
|
||||||
events.push(Event::Resize(Vec2::new(width as u32, height as u32)));
|
events.push(Event::Resize(Vec2::new(width as u32, height as u32)));
|
||||||
},
|
},
|
||||||
|
glutin::WindowEvent::Moved(glutin::dpi::LogicalPosition { x, y }) => {
|
||||||
|
events.push(Event::Moved(Vec2::new(x as u32, y as u32)))
|
||||||
|
},
|
||||||
glutin::WindowEvent::ReceivedCharacter(c) => events.push(Event::Char(c)),
|
glutin::WindowEvent::ReceivedCharacter(c) => events.push(Event::Char(c)),
|
||||||
glutin::WindowEvent::MouseInput { button, state, .. } => {
|
glutin::WindowEvent::MouseInput { button, state, .. } => {
|
||||||
if let (true, Some(game_inputs)) = (
|
if let (true, Some(game_inputs)) = (
|
||||||
|
Loading…
Reference in New Issue
Block a user