Bug fix: window/floating sizes
This commit is contained in:
parent
6aadf4128e
commit
0fdc1048c8
3 changed files with 22 additions and 1 deletions
|
@ -107,6 +107,11 @@ impl Floating {
|
|||
|
||||
state.pos = state.pos.round();
|
||||
|
||||
// ctx.debug_rect(
|
||||
// Rect::from_min_size(state.pos, state.size),
|
||||
// &format!("Floating size: {:?}", state.size),
|
||||
// );
|
||||
|
||||
if move_interact.active || mouse_pressed_on_floating(ctx, id) {
|
||||
ctx.memory().move_floating_to_top(id);
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ impl Frame {
|
|||
},
|
||||
);
|
||||
|
||||
region.expand_to_include_child(child_region.rect().expand2(margin));
|
||||
region.expand_to_include_child(child_region.child_bounds().expand2(margin));
|
||||
// TODO: move up cursor?
|
||||
}
|
||||
}
|
||||
|
|
|
@ -289,6 +289,22 @@ impl Context {
|
|||
);
|
||||
}
|
||||
|
||||
pub fn debug_rect(&self, rect: Rect, text: &str) {
|
||||
let layer = Layer::Debug;
|
||||
self.add_paint_cmd(
|
||||
layer,
|
||||
PaintCmd::Rect {
|
||||
corner_radius: 0.0,
|
||||
fill_color: None,
|
||||
outline: Some(Outline::new(1.0, color::RED)),
|
||||
rect,
|
||||
},
|
||||
);
|
||||
let align = (Align::Min, Align::Min);
|
||||
let text_style = TextStyle::Monospace;
|
||||
self.floating_text(layer, rect.min, text, text_style, align, Some(color::RED));
|
||||
}
|
||||
|
||||
/// Show some text anywhere on screen.
|
||||
/// To center the text at the given position, use `align: (Center, Center)`.
|
||||
pub fn floating_text(
|
||||
|
|
Loading…
Reference in a new issue