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
bevyengine/bevy#8306.

## Solution

Remove the inversion of the Y axis when propagates window change back to
winit.
  • Loading branch information
tguichaoua authored Aug 17, 2023
1 parent d699ae2 commit 521d94b
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,13 +179,7 @@ pub(crate) fn changed_windows(

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 521d94b

Please sign in to comment.