Browse Source

Bug fix: window/floating sizes

readable-ids
Emil Ernerfeldt 5 years ago
parent
commit
0fdc1048c8
  1. 5
      emigui/src/containers/floating.rs
  2. 2
      emigui/src/containers/frame.rs
  3. 16
      emigui/src/context.rs

5
emigui/src/containers/floating.rs

@ -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);
}

2
emigui/src/containers/frame.rs

@ -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?
}
}

16
emigui/src/context.rs

@ -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…
Cancel
Save