mirror of
https://github.com/emilk/egui.git
synced 2026-09-01 14:20:04 -04:00
Constrain demo windows to the space left after the panels (#7785)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
use egui::{
|
||||
Color32, Context, Pos2, Rect, Ui,
|
||||
Color32, Pos2, Rect, Ui,
|
||||
containers::{Frame, Window},
|
||||
emath, epaint,
|
||||
epaint::PathStroke,
|
||||
@@ -18,13 +18,14 @@ impl crate::Demo for DancingStrings {
|
||||
"♫ Dancing Strings"
|
||||
}
|
||||
|
||||
fn show(&mut self, ctx: &Context, open: &mut bool) {
|
||||
fn show(&mut self, ui: &mut Ui, open: &mut bool) {
|
||||
use crate::View as _;
|
||||
Window::new(self.name())
|
||||
.open(open)
|
||||
.default_size(vec2(512.0, 256.0))
|
||||
.vscroll(false)
|
||||
.show(ctx, |ui| self.ui(ui));
|
||||
.constrain_to(ui.available_rect_before_wrap())
|
||||
.show(ui, |ui| self.ui(ui));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user