Skip to content

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

Properties: Frame Fitting has Auto-Fit and Options, as in InDesign; checkboxes are named for screen readers

moppeeer6e2d34979901
diff --git a/ROADMAP.md b/ROADMAP.md
index 0128924c0..3a334b9d3 100644
--- a/ROADMAP.md
+++ b/ROADMAP.md
@@ -348,6 +348,7 @@ list) · [roadmap.md](docs/roadmap.md) (milestones, plan) · [parity-checklist.m
Newest first.
+- **2026-10-20** · Properties › Frame Fitting has InDesign's Auto-Fit checkbox and Options button (Frame Fitting Options); the app's checkboxes are now named and ticked-or-not for screen readers. No readiness percentage change.
- **2026-10-16** · Type › Reload Fonts (`font.reload`): fonts installed, edited or removed while DesignCraft runs are read again without a restart, and the open documents recompose with them (#328, #547). An edited font file is noticed by its length and modification time; bundled, added and document fonts stay as they are. InDesign does this by itself, so noticing changes automatically is still open (gap 6). No readiness percentage change.
- **2026-10-16** · Parents can be deleted from their Pages-panel context menu or `layout.parents.delete {id}`. Applied-page and based-on references are cleared, local override copies survive, and Undo restores the parent. Addresses the deletion portion of #956; no readiness percentage change.
- **2026-10-17** · File › Package writes the document's and the IDML's links relative to the package (`Links/logo.png`, `file:Links/logo.png`), so a package holds no path from the machine that made it; opening a document resolves them to the files beside it. Links › Copy Link(s) To still links by full path. (#340). No readiness percentage change.
diff --git a/crates/ui-egui/src/panels/properties.rs b/crates/ui-egui/src/panels/properties.rs
index 44acf6e2c..b15e3471d 100644
--- a/crates/ui-egui/src/panels/properties.rs
+++ b/crates/ui-egui/src/panels/properties.rs
@@ -167,7 +167,21 @@ pub fn show(app: &mut DesignApp, ui: &mut egui::Ui) {
let _ = app.run("object.fit", json!({"mode": mode}));
}
}
+ // Frame Fitting Options…, as InDesign's Options button beside the fitting buttons.
+ if outline_button(ui, crate::i18n::tr(&app.ui.language, "Options"), 64.0).clicked() {
+ crate::menus::activate(app, "app.fittingOptions", &Value::Null);
+ }
});
+ // Auto-Fit: the graphic is refitted whenever its frame is resized.
+ let mut auto = app
+ .session
+ .active()
+ .and_then(|st| st.selection.items.first().and_then(|id| st.doc.item(*id)))
+ .and_then(|it| it.graphic())
+ .is_some_and(|g| g.auto_fit != designcraft_doc::Fitting::None);
+ if widgets::checkbox(ui, &mut auto, crate::i18n::tr(&app.ui.language, "Auto-Fit")).changed() {
+ let _ = app.run("object.fittingOptions", json!({"autoFit": auto}));
+ }
divider(ui);
}
section(ui, crate::i18n::tr(&app.ui.language, "Text Wrap"), true);
@@ -3343,6 +3357,32 @@ mod tests {
assert!((r.x0 - 200.0).abs() < 0.5 && (r.y1 - 200.0).abs() < 0.5 && (r.x1 - 300.0).abs() < 0.5, "{r:?}");
}
+ /// Properties › Frame Fitting has Auto-Fit and an Options button, as InDesign's: ticking
+ /// Auto-Fit makes the picture refit when its frame is resized.
+ #[test]
+ fn properties_frame_fitting_sets_auto_fit_and_opens_its_options() {
+ let mut app = DesignApp::new(designcraft_engine::Session::new(), crate::Services::default());
+ app.run("file.new", json!({})).unwrap();
+ let id = app.run("frame.create", json!({"rect": [72, 72, 272, 172]})).unwrap()["id"].as_u64().unwrap();
+ let png = designcraft_render::Rendered { width: 40, height: 20, pixels: vec![200; 40 * 20 * 4] }.to_png();
+ app.run("file.place", json!({"base64": designcraft_engine::cmd::base64_encode(&png), "name": "p.png", "frame": id})).unwrap();
+ app.run("selection.set", json!({"ids": [id]})).unwrap();
+ let graphic = |app: &DesignApp| app.session.active().unwrap().doc.item(designcraft_doc::ids::ItemId(id)).unwrap().graphic().unwrap().clone();
+ assert_eq!(graphic(&app).auto_fit, designcraft_doc::Fitting::None);
+ let mut h = panel(app);
+ h.get_by_label("Auto-Fit").click();
+ h.run_steps(3);
+ assert_ne!(graphic(h.state()).auto_fit, designcraft_doc::Fitting::None, "Auto-Fit is on");
+ // The frame resized: the picture follows it.
+ h.state_mut().run("transform.resize", json!({"from": [72, 72, 272, 172], "to": [72, 72, 372, 272]})).unwrap();
+ let g = graphic(h.state());
+ let r = g.xf.transform_rect_bbox(designcraft_geom::Rect::new(0.0, 0.0, g.size.0, g.size.1));
+ assert!(r.width() > 250.0, "refitted to the larger frame: {r:?}");
+ h.get_by_label("Options").click();
+ h.run_steps(3);
+ assert!(h.state().ui.dialog.is_some(), "Frame Fitting Options opens");
+ }
+
const CYAN: &str = "C=100 M=0 Y=0 K=0";
#[test]
diff --git a/crates/ui-egui/src/widgets.rs b/crates/ui-egui/src/widgets.rs
index fb9876aa2..645c83c1a 100644
--- a/crates/ui-egui/src/widgets.rs
+++ b/crates/ui-egui/src/widgets.rs
@@ -567,6 +567,9 @@ pub fn checkbox(ui: &mut Ui, on: &mut bool, label: &str) -> Response {
*on = !*on;
resp.mark_changed();
}
+ // Named and ticked or not for screen readers (and tests).
+ let checked = *on;
+ resp.widget_info(|| egui::WidgetInfo::selected(egui::WidgetType::Checkbox, true, checked, label));
resp
}