Revert "Don't constrain immovable egui windows to native window (#1049)" (#1054)

This reverts commit 7b641be7b0.
It accidentally disabled constraining for all windows
This commit is contained in:
Lampsitter 2022-01-09 15:32:09 +01:00 committed by GitHub
parent 342737e2f0
commit 611eaa52e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 11 deletions

View file

@ -15,7 +15,6 @@ NOTE: [`epaint`](epaint/CHANGELOG.md), [`eframe`](eframe/CHANGELOG.md), [`egui_w
### Fixed 🐛 ### Fixed 🐛
* Context menu now respects the theme ([#1043](https://github.com/emilk/egui/pull/1043)) * Context menu now respects the theme ([#1043](https://github.com/emilk/egui/pull/1043))
* Immovable windows can no longer incorrectly move ([#1049](https://github.com/emilk/egui/pull/1049))
## 0.16.1 - 2021-12-31 - Add back `CtxRef::begin_frame,end_frame` ## 0.16.1 - 2021-12-31 - Add back `CtxRef::begin_frame,end_frame`

View file

@ -399,11 +399,9 @@ impl<'open> Window<'open> {
content_inner content_inner
}; };
if area.movable {
area.state_mut().pos = ctx area.state_mut().pos = ctx
.constrain_window_rect_to_area(area.state().rect(), area.drag_bounds()) .constrain_window_rect_to_area(area.state().rect(), area.drag_bounds())
.min; .min;
}
let full_response = area.end(ctx, area_content_ui); let full_response = area.end(ctx, area_content_ui);
@ -510,11 +508,7 @@ fn interact(
let new_rect = move_and_resize_window(ctx, &window_interaction)?; let new_rect = move_and_resize_window(ctx, &window_interaction)?;
let new_rect = ctx.round_rect_to_pixels(new_rect); let new_rect = ctx.round_rect_to_pixels(new_rect);
let new_rect = if area.movable { let new_rect = ctx.constrain_window_rect_to_area(new_rect, area.drag_bounds());
ctx.constrain_window_rect_to_area(new_rect, area.drag_bounds())
} else {
new_rect
};
// TODO: add this to a Window state instead as a command "move here next frame" // TODO: add this to a Window state instead as a command "move here next frame"
area.state_mut().pos = new_rect.min; area.state_mut().pos = new_rect.min;