Skip to content

Commit

Permalink
Fix Window::set_cursor_position (#9456)
Browse files Browse the repository at this point in the history
# Objective

Fixes #9455

This change has probably been forgotten in
#8306.

## Solution

Remove the inversion of the Y axis when propagates window change back to
winit.
  • Loading branch information
tguichaoua authored and cart committed Aug 18, 2023
1 parent 7a3fe8f commit 12c6fa7
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions crates/bevy_winit/src/system.rs
Expand Up @@ -174,13 +174,7 @@ pub(crate) fn changed_window(

if window.physical_cursor_position() != cache.window.physical_cursor_position() {
if let Some(physical_position) = window.physical_cursor_position() {
let inner_size = winit_window.inner_size();

let position = PhysicalPosition::new(
physical_position.x,
// Flip the coordinate space back to winit's context.
inner_size.height as f32 - physical_position.y,
);
let position = PhysicalPosition::new(physical_position.x, physical_position.y);

if let Err(err) = winit_window.set_cursor_position(position) {
error!("could not set cursor position: {:?}", err);
Expand Down

0 comments on commit 12c6fa7

Please sign in to comment.