[window] Fix: no hover effect when already dragging something
@@ -468,7 +468,12 @@ fn resize_hover(
area_layer_id: LayerId,
rect: Rect,
) -> Option<WindowInteraction> {
- if let Some(mouse_pos) = ctx.input().mouse.pos {
+ let mouse_pos = ctx.input().mouse.pos?;
+
+ if ctx.input().mouse.down && !ctx.input().mouse.pressed {
+ return None; // already dragging (something)
+ }
+
if let Some(top_layer_id) = ctx.layer_id_at(mouse_pos) {
if top_layer_id != area_layer_id && top_layer_id.order != Order::Background {
return None; // Another window is on top here
@@ -482,7 +487,10 @@ fn resize_hover(
let side_grab_radius = ctx.style().interaction.resize_grab_radius_side;
let corner_grab_radius = ctx.style().interaction.resize_grab_radius_corner;
- if rect.expand(side_grab_radius).contains(mouse_pos) {
+ if !rect.expand(side_grab_radius).contains(mouse_pos) {
+ return None;
+ }
+
let (mut left, mut right, mut top, mut bottom) = Default::default();
if possible.resizable {
right = (rect.right() - mouse_pos.x).abs() <= side_grab_radius;
@@ -529,12 +537,6 @@ fn resize_hover(
} else {
None
}
- } else {
- None
- }
- } else {
- None
- }
}
/// Fill in parts of the window frame when we resize by dragging that part
