From 69cff999c4ca07ea1209abd827e4007e01c82a80 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Fri, 4 Jul 2025 09:47:14 +0200 Subject: [PATCH] Fix debug-assert triggered by menu->is_moving_towards_rect->intersects_ray --- crates/egui/src/input_state/mod.rs | 5 ++++- crates/emath/src/rect.rs | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/egui/src/input_state/mod.rs b/crates/egui/src/input_state/mod.rs index fd3e78a2193..a3ebf532ebd 100644 --- a/crates/egui/src/input_state/mod.rs +++ b/crates/egui/src/input_state/mod.rs @@ -1465,7 +1465,10 @@ impl PointerState { } if let Some(pos) = self.hover_pos() { - return rect.intersects_ray(pos, self.direction()); + let dir = self.direction(); + if dir != Vec2::ZERO { + return rect.intersects_ray(pos, self.direction()); + } } false } diff --git a/crates/emath/src/rect.rs b/crates/emath/src/rect.rs index dc63315b6e1..777c12527b9 100644 --- a/crates/emath/src/rect.rs +++ b/crates/emath/src/rect.rs @@ -651,7 +651,7 @@ impl Rect { pub fn intersects_ray(&self, o: Pos2, d: Vec2) -> bool { debug_assert!( d.is_normalized(), - "expected normalized direction, but `d` has length {}", + "Debug assert: expected normalized direction, but `d` has length {}", d.length() );