mirror of
https://github.com/storytold/designcraft.git
synced 2026-11-12 05:12:39 +00:00
Document properties: the page box field in its own function
Keeps document_sections within clippy's cognitive complexity limit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
34d97eae37
commit
fd3d2f4e49
1 file changed
+10
-8
@@ -172,6 +172,15 @@ fn page_preset_menu(ui: &mut Ui, pw: f64, ph: f64) -> Option<(f64, f64)> {
|
||||
preset
|
||||
}
|
||||
|
||||
/// As the status bar's page box: the page, or the parent shown ("A-Parent"); then the parents.
|
||||
fn page_box_field(app: &mut DesignApp, ui: &mut Ui, b: Rect) {
|
||||
let Some(pb) = crate::canvas::page_box(app) else { return };
|
||||
let picked = place(ui, sub(b, 0.0, 0.0, 93.0, FIELD_H), |ui| widgets::dropdown_list(ui, pb.current_name(), 93.0, &pb.names, Some(pb.current)));
|
||||
if let Some(i) = picked {
|
||||
crate::canvas::page_box_go(app, &pb, i);
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn document_sections(app: &mut DesignApp, ui: &mut Ui) {
|
||||
let u = units(app);
|
||||
let Some(st) = app.session.active() else { return };
|
||||
@@ -287,14 +296,7 @@ pub(super) fn document_sections(app: &mut DesignApp, ui: &mut Ui) {
|
||||
// Page.
|
||||
section(ui, crate::i18n::tr(&app.ui.language, "Page"), true);
|
||||
let b = block(ui, FIELD_H);
|
||||
// As the status bar's page box: the page, or the parent shown ("A-Parent"); then the parents.
|
||||
if let Some(pb) = crate::canvas::page_box(app) {
|
||||
let picked =
|
||||
place(ui, sub(b, 0.0, 0.0, 93.0, FIELD_H), |ui| widgets::dropdown_list(ui, pb.current_name(), 93.0, &pb.names, Some(pb.current)));
|
||||
if let Some(i) = picked {
|
||||
crate::canvas::page_box_go(app, &pb, i);
|
||||
}
|
||||
}
|
||||
page_box_field(app, ui, b);
|
||||
let (add, del) = place(ui, sub(b, 172.0, 0.0, 50.0, FIELD_H), |ui| {
|
||||
ui.spacing_mut().item_spacing.x = 4.0;
|
||||
let a = widgets::icon_toggle_sized(ui, "style-new", false, "Insert Page", vec2(22.0, 21.0)).clicked();
|
||||
|
||||
Reference in new issue
Block a user