Skip to content

Commit 7f08e41

Browse files
author
Nathan Jeffords
committed
adjust y coordinate when setting cursor position to match value received
in `CursorMoved` events
1 parent 72d1d9d commit 7f08e41

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

crates/bevy_winit/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,11 @@ fn change_window(_: &mut World, resources: &mut Resources) {
9696
}
9797
bevy_window::WindowCommand::SetCursorPosition { position } => {
9898
let window = winit_windows.get_window(id).unwrap();
99+
let inner_size = window.inner_size().to_logical::<f32>(window.scale_factor());
99100
window
100101
.set_cursor_position(winit::dpi::LogicalPosition::new(
101-
position.x, position.y,
102+
position.x,
103+
inner_size.height - position.y,
102104
))
103105
.unwrap_or_else(|e| error!("Unable to set cursor position: {}", e));
104106
}

0 commit comments

Comments
 (0)