Skip to content

Commit

Permalink
adjust y coordinate when setting cursor position to match value received
Browse files Browse the repository at this point in the history
in `CursorMoved` events
  • Loading branch information
Nathan Jeffords committed Dec 3, 2020
1 parent bd97b6a commit bc9562b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion crates/bevy_winit/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,11 @@ fn change_window(_: &mut World, resources: &mut Resources) {
}
bevy_window::WindowCommand::SetCursorPosition { position } => {
let window = winit_windows.get_window(id).unwrap();
let inner_size = window.inner_size().to_logical::<f32>(window.scale_factor());
window
.set_cursor_position(winit::dpi::LogicalPosition::new(
position.x, position.y,
position.x,
inner_size.height - position.y,
))
.unwrap_or_else(|e| error!("Unable to set cursor position: {}", e));
}
Expand Down

0 comments on commit bc9562b

Please sign in to comment.