From 2ac2f2d45edbc200903c441fed5facaca928beef Mon Sep 17 00:00:00 2001 From: Tim Vincent Date: Mon, 22 Jan 2024 14:04:23 -0800 Subject: [PATCH] stops centering the cursor to prevent camera jumping when the cursor grab is released --- CHANGELOG.md | 1 + voxygen/src/hud/mod.rs | 4 ++++ voxygen/src/window.rs | 3 +++ 3 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b7e3ed8ddb..d20e78c7fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -80,6 +80,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - You can no longer stack self buffs - Renamed "Burning Potion" to "Potion of Combustion" - Render LoD terrain on the character selection screen +- Camera no longer jumps on first mouse event after cursor grab is released on macos ### Removed - Medium and large potions from all loot tables diff --git a/voxygen/src/hud/mod.rs b/voxygen/src/hud/mod.rs index 94151b2ccc..bbd86fe03b 100755 --- a/voxygen/src/hud/mod.rs +++ b/voxygen/src/hud/mod.rs @@ -1162,6 +1162,10 @@ impl Show { ui.handle_event(ui::Event( conrod_core::input::Motion::MouseCursor { x: 0.0, y: 0.0 }.into(), )); + + //TODO: An underlying OS call in winit is causing the camera to jump upon the + // next mouse movement event in macos https://github.com/rust-windowing/winit/issues/999 + #[cfg(not(target_os = "macos"))] global_state.window.center_cursor(); } } diff --git a/voxygen/src/window.rs b/voxygen/src/window.rs index e2e5076562..e73a74a394 100644 --- a/voxygen/src/window.rs +++ b/voxygen/src/window.rs @@ -988,6 +988,9 @@ impl Window { }, WindowEvent::CursorMoved { position, .. } => { if self.cursor_grabbed { + //TODO: An underlying OS call in winit is causing the camera to jump upon the + // next mouse movement event in macos https://github.com/rust-windowing/winit/issues/999 + #[cfg(not(target_os = "macos"))] self.center_cursor(); } else { self.cursor_position = position;