diff --git a/crates/egui/src/input_state/mod.rs b/crates/egui/src/input_state/mod.rs index 49027c06e..37faf64c2 100644 --- a/crates/egui/src/input_state/mod.rs +++ b/crates/egui/src/input_state/mod.rs @@ -319,7 +319,9 @@ pub struct InputState { /// Which modifier keys are down at the start of the frame? pub modifiers: Modifiers, - // The keys that are currently being held down. + /// The keys that are currently being held down. + /// + /// Keys released this frame are NOT considered down. pub keys_down: HashSet, /// In-order events received this frame @@ -765,6 +767,8 @@ impl InputState { } /// Is the given key currently held down? + /// + /// Keys released this frame are NOT considered down. pub fn key_down(&self, desired_key: Key) -> bool { self.keys_down.contains(&desired_key) } @@ -1018,6 +1022,7 @@ pub struct PointerState { /// Used for calculating velocity of pointer. pos_history: History, + /// Buttons currently down, excluding those released this frame. down: [bool; NUM_POINTER_BUTTONS], /// Where did the current click/drag originate? @@ -1405,6 +1410,8 @@ impl PointerState { } /// Is any pointer button currently down? + /// + /// Buttons released this frame are NOT considered down. pub fn any_down(&self) -> bool { self.down.iter().any(|&down| down) } @@ -1460,6 +1467,8 @@ impl PointerState { } /// Is this button currently down? + /// + /// Buttons released this frame are NOT considered down. #[inline(always)] pub fn button_down(&self, button: PointerButton) -> bool { self.down[button as usize] @@ -1516,18 +1525,24 @@ impl PointerState { } /// Is the primary button currently down? + /// + /// Buttons released this frame are NOT considered down. #[inline(always)] pub fn primary_down(&self) -> bool { self.button_down(PointerButton::Primary) } /// Is the secondary button currently down? + /// + /// Buttons released this frame are NOT considered down. #[inline(always)] pub fn secondary_down(&self) -> bool { self.button_down(PointerButton::Secondary) } /// Is the middle button currently down? + /// + /// Buttons released this frame are NOT considered down. #[inline(always)] pub fn middle_down(&self) -> bool { self.button_down(PointerButton::Middle) diff --git a/crates/egui_kittest/src/snapshot.rs b/crates/egui_kittest/src/snapshot.rs index 4d139fcbb..8134dbdf0 100644 --- a/crates/egui_kittest/src/snapshot.rs +++ b/crates/egui_kittest/src/snapshot.rs @@ -721,11 +721,14 @@ impl Harness<'_, State> { }) .unwrap(); + // Close temp file so it isn't locked when `open` tries to launch it (on Windows) + let path = temp_file.into_temp_path(); + #[expect(clippy::print_stdout)] { println!("Wrote debug snapshot to: {}", path.display()); } - let result = open::that(path); + let result = open::that(&path); if let Err(err) = result { #[expect(clippy::print_stderr)] { diff --git a/crates/egui_kittest/tests/snapshots/should_wait_for_images.png b/crates/egui_kittest/tests/snapshots/should_wait_for_images.png index be474dfc3..54c0f9d76 100644 --- a/crates/egui_kittest/tests/snapshots/should_wait_for_images.png +++ b/crates/egui_kittest/tests/snapshots/should_wait_for_images.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c419519f1cddb37c54e30071a3a9519106807e8ae3fe812649c12ee5a1b7c5db -size 2729 +oid sha256:845acb34152fb829dc24c606b1741e250f1d1fa645236ef57fce0cbda104c465 +size 2121