Keep windows within the screen
This commit is contained in:
parent
44d93d3701
commit
1affa10dee
1 changed files with 8 additions and 0 deletions
|
@ -239,6 +239,14 @@ impl Window {
|
||||||
outer_rect: outer_rect,
|
outer_rect: outer_rect,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Constrain to screen:
|
||||||
|
let margin = 32.0;
|
||||||
|
state.outer_pos = state.outer_pos.max(pos2(margin - outer_rect.width(), 0.0));
|
||||||
|
state.outer_pos = state.outer_pos.min(pos2(
|
||||||
|
ctx.input.screen_size.x - margin,
|
||||||
|
ctx.input.screen_size.y - margin,
|
||||||
|
));
|
||||||
|
|
||||||
if win_interact.active || corner_interact.active || mouse_pressed_on_window(ctx, id) {
|
if win_interact.active || corner_interact.active || mouse_pressed_on_window(ctx, id) {
|
||||||
ctx.memory.lock().move_window_to_top(id);
|
ctx.memory.lock().move_window_to_top(id);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue