Skip to content

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

Properties: the Align To button shows its target, as InDesign's

moppeeer72541208031c
diff --git a/ROADMAP.md b/ROADMAP.md
index 0128924c0..35f5b8d7c 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-21** · Properties › Align: the Align To button shows what the objects align to, one glyph each for the selection, the key object, the margins, the page and the spread, as InDesign's. Found in the Learn Skills Daily course, chapter 12. 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/icons.rs b/crates/ui-egui/src/icons.rs
index a90fe989e..2142b2b54 100644
--- a/crates/ui-egui/src/icons.rs
+++ b/crates/ui-egui/src/icons.rs
@@ -828,6 +828,33 @@ pub fn paint(p: &Painter, r: Rect, name: &str, c: Color32) {
_ => {}
}
}
+ // Properties › Align To, one glyph per target, with the drop-down mark: a page with its
+ // margins, a page, a spread of two pages, a key object drawn bold.
+ "align-to-margins" | "align-to-page" | "align-to-spread" | "align-to-key" => {
+ match name {
+ "align-to-margins" => {
+ pen.closed(&[(4.0, 2.5), (11.5, 2.5), (14.5, 5.5), (14.5, 16.0), (4.0, 16.0)]);
+ pen.w = 1.0;
+ pen.rect(6.5, 6.0, 12.0, 13.5);
+ }
+ "align-to-page" => {
+ pen.closed(&[(4.0, 2.5), (11.5, 2.5), (14.5, 5.5), (14.5, 16.0), (4.0, 16.0)]);
+ pen.line(&[(11.5, 2.5), (11.5, 5.5), (14.5, 5.5)]);
+ }
+ "align-to-spread" => {
+ pen.rect(1.5, 4.0, 8.5, 15.0);
+ pen.rect(8.5, 4.0, 15.5, 15.0);
+ }
+ _ => {
+ pen.rect(3.0, 4.0, 15.0, 14.0);
+ pen.frect(3.0, 4.0, 15.0, 6.0);
+ pen.frect(3.0, 12.0, 15.0, 14.0);
+ pen.frect(3.0, 4.0, 5.0, 14.0);
+ pen.frect(13.0, 4.0, 15.0, 14.0);
+ }
+ }
+ pen.fill(&[(16.0, 17.0), (19.5, 17.0), (17.75, 19.0)]);
+ }
"align-to" | "frame-dashed" => {
pen.w = 1.0;
for (a, b) in [((3.0, 3.0), (15.0, 3.0)), ((15.0, 3.0), (15.0, 15.0)), ((15.0, 15.0), (3.0, 15.0)), ((3.0, 15.0), (3.0, 3.0))] {
@@ -1152,6 +1179,20 @@ mod tests {
assert!(!arrow_filled("tool-direct"), "Direct Selection draws a filled arrow");
}
+ /// Each Align To target has its own glyph, none the placeholder.
+ #[test]
+ fn align_to_glyphs_are_distinct() {
+ let names = ["align-to", "align-to-key", "align-to-margins", "align-to-page", "align-to-spread"];
+ let unknown = drawing("no-such-icon");
+ let glyphs: Vec<String> = names.iter().map(|n| drawing(n)).collect();
+ for (k, g) in glyphs.iter().enumerate() {
+ assert_ne!(*g, unknown, "{} falls back to the placeholder", names[k]);
+ for (j, other) in glyphs.iter().enumerate().skip(k + 1) {
+ assert_ne!(g, other, "{} and {} draw alike", names[k], names[j]);
+ }
+ }
+ }
+
#[test]
fn distribute_icons_are_distinct_from_align_and_each_other() {
// `objalign-*` ship upstream and back the Properties Align row; only the
diff --git a/crates/ui-egui/src/panels/properties.rs b/crates/ui-egui/src/panels/properties.rs
index 44acf6e2c..81ba86643 100644
--- a/crates/ui-egui/src/panels/properties.rs
+++ b/crates/ui-egui/src/panels/properties.rs
@@ -947,6 +947,17 @@ fn swatch_menu(
}
}
+/// The Align To button's glyph shows what the objects align to, as InDesign's.
+fn align_to_icon(to: &str) -> &'static str {
+ match to {
+ "keyObject" => "align-to-key",
+ "margins" => "align-to-margins",
+ "page" => "align-to-page",
+ "spread" => "align-to-spread",
+ _ => "align-to",
+ }
+}
+
fn align_row(app: &mut DesignApp, ui: &mut Ui) {
let t = Tokens::get(ui.ctx());
ui.horizontal(|ui| {
@@ -961,7 +972,7 @@ fn align_row(app: &mut DesignApp, ui: &mut Ui) {
other => other,
};
let tip = format!("{}: {}", crate::i18n::tr(&app.ui.language, "Align To"), crate::i18n::tr(&app.ui.language, to_label));
- let resp = icon_toggle(ui, "align-to", false, &tip);
+ let resp = icon_toggle(ui, align_to_icon(&to), false, &tip);
egui::Popup::menu(&resp).show(|ui| {
for (label, id) in [
("Align to Selection", "selection"),
@@ -3419,6 +3430,16 @@ mod tests {
assert_eq!(doc.item(designcraft_doc::ids::ItemId(id)).unwrap().fill.swatch, "[None]", "the frame isn't");
}
+ /// The Align To button shows the target picked in its menu.
+ #[test]
+ fn the_align_to_button_shows_its_target() {
+ assert_eq!(align_to_icon("selection"), "align-to");
+ assert_eq!(align_to_icon("keyObject"), "align-to-key");
+ assert_eq!(align_to_icon("margins"), "align-to-margins");
+ assert_eq!(align_to_icon("page"), "align-to-page");
+ assert_eq!(align_to_icon("spread"), "align-to-spread");
+ }
+
#[test]
fn transform_flips_and_rotates_from_properties() {
let mut app = DesignApp::new(designcraft_engine::Session::new(), crate::Services::default());