1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-31 05:40:03 -04:00

Simplify and unify queries about available space

This commit is contained in:
Emil Ernerfeldt
2020-05-12 18:21:09 +02:00
parent 6f7bc3cfac
commit 7a1c97ccfe
15 changed files with 91 additions and 108 deletions

View File

@@ -354,7 +354,7 @@ impl Painting {
ui.add_custom_contents(vec2(f32::INFINITY, 200.0), |ui| {
let canvas_corner = ui.cursor();
let interact = ui.reserve_space(ui.available_space(), Some(ui.id()));
let interact = ui.reserve_space(ui.available().size(), Some(ui.id()));
ui.set_clip_rect(ui.clip_rect().intersect(interact.rect)); // Make sure we don't paint out of bounds
if self.lines.is_empty() {

View File

@@ -123,7 +123,7 @@ impl FractalClock {
Hand::from_length_angle(0.5, angle_from_period(12.0 * 60.0 * 60.0)),
];
let rect = ui.available_rect_min();
let rect = ui.available_finite();
let scale = self.zoom * rect.width().min(rect.height());
let mut paint_line = |points: [Pos2; 2], color: Color, width: f32| {