Skip to content

DesignCraft: An open-source page and layout design editor written by scratch in pure Rust

Dialogs: the Color Picker opens at its full height (#2129)

Paul Gemignani5f86f33c4274
diff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rs
index d546cd108..132d80a24 100644
--- a/crates/ui-egui/src/dialogs.rs
+++ b/crates/ui-egui/src/dialogs.rs
@@ -3016,9 +3016,16 @@ pub fn show(app: &mut DesignApp, ctx: &egui::Context) {
result = Some(false);
}
}
- // A centred window only offers its body last frame's height: let this one grow to its
- // options' height (the screen still caps it).
- let min_body = if side_actions { body_height.min(crate::section_options::BODY_H) } else { 1.0 };
+ // A centred window only offers its body last frame's height: let these grow to their
+ // content's height (the screen still caps it). Numbering & Section Options has its
+ // options beside its buttons; the Color Picker lays itself out on a fixed canvas, which
+ // otherwise shows only its top strip (the field cut off, no values, no hex) behind a
+ // scrollbar.
+ let min_body = match d.id.as_str() {
+ "numberingSection" => body_height.min(crate::section_options::BODY_H),
+ "colorPicker" => body_height.min(picker_layout::SIZE.y + 2.0 * ui.spacing().item_spacing.y),
+ _ => 1.0,
+ };
egui::ScrollArea::both()
.id_salt(("dialog_body", &d.id))
.min_scrolled_width(1.0)