Resize windows based on cursor position rather than movement
This commit is contained in:
parent
98178e9d69
commit
3eeb4eca2c
1 changed files with 5 additions and 3 deletions
|
@ -163,9 +163,11 @@ impl Window {
|
|||
let win_interact = ctx.interact(layer, state.rect, Some(id.with(&"window")));
|
||||
|
||||
if corner_interact.active {
|
||||
let new_size = state.rect.size() + ctx.input().mouse_move;
|
||||
if let Some(mouse_pos) = ctx.input().mouse_pos {
|
||||
let new_size = mouse_pos - state.rect.min() + 0.5 * corner_interact.rect.size();
|
||||
let new_size = new_size.max(Vec2::splat(0.0));
|
||||
state.rect = Rect::from_min_size(state.rect.min(), new_size);
|
||||
}
|
||||
} else if win_interact.active {
|
||||
state.rect = state.rect.translate(ctx.input().mouse_move);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue