[window] Fix: no hover effect when already dragging something
This commit is contained in:
parent
9833ca57a6
commit
4c25465e57
1 changed files with 61 additions and 59 deletions
|
@ -468,7 +468,12 @@ fn resize_hover(
|
||||||
area_layer_id: LayerId,
|
area_layer_id: LayerId,
|
||||||
rect: Rect,
|
rect: Rect,
|
||||||
) -> Option<WindowInteraction> {
|
) -> 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 let Some(top_layer_id) = ctx.layer_id_at(mouse_pos) {
|
||||||
if top_layer_id != area_layer_id && top_layer_id.order != Order::Background {
|
if top_layer_id != area_layer_id && top_layer_id.order != Order::Background {
|
||||||
return None; // Another window is on top here
|
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 side_grab_radius = ctx.style().interaction.resize_grab_radius_side;
|
||||||
let corner_grab_radius = ctx.style().interaction.resize_grab_radius_corner;
|
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();
|
let (mut left, mut right, mut top, mut bottom) = Default::default();
|
||||||
if possible.resizable {
|
if possible.resizable {
|
||||||
right = (rect.right() - mouse_pos.x).abs() <= side_grab_radius;
|
right = (rect.right() - mouse_pos.x).abs() <= side_grab_radius;
|
||||||
|
@ -529,12 +537,6 @@ fn resize_hover(
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Fill in parts of the window frame when we resize by dragging that part
|
/// Fill in parts of the window frame when we resize by dragging that part
|
||||||
|
|
Loading…
Reference in a new issue