DesignCraft: An open-source page and layout design editor written by scratch in pure Rust
Effects dialog: InDesign's angle dial beside each Angle field
moppeeer161b359c37ce
diff --git a/ROADMAP.md b/ROADMAP.mdindex 0128924c0..8c7b008b0 100644--- a/ROADMAP.md+++ b/ROADMAP.md@@ -348,6 +348,7 @@ list) · [roadmap.md](docs/roadmap.md) (milestones, plan) · [parity-checklist.mNewest first.+- **2026-10-21** · Effects dialog: the Angle field of the shadows, Bevel and Emboss, Satin and Gradient Feather has InDesign's dial beside it, its radius pointing where the light comes from; a click or drag on it sets the angle. Found in the Learn Skills Daily course, chapter 14. 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/effects_dialog.rs b/crates/ui-egui/src/effects_dialog.rsindex 456ca4a58..d0c2228b8 100644--- a/crates/ui-egui/src/effects_dialog.rs+++ b/crates/ui-egui/src/effects_dialog.rs@@ -204,10 +204,41 @@ fn percent(ui: &mut egui::Ui, d: &mut Dialog, path: &[&str]) {fn angle(ui: &mut egui::Ui, d: &mut Dialog, path: &[&str], enabled: bool, global: f64) {let mut v = if enabled { num(d, path) } else { global };- let r = ui.add_enabled(enabled, egui::DragValue::new(&mut v).range(-180.0..=180.0).suffix("°").max_decimals(1));- if r.changed() {- set(d, path, json!(v));+ ui.horizontal(|ui| {+ if let Some(a) = angle_dial(ui, v, enabled) {+ v = a;+ set(d, path, json!(v));+ }+ let r = ui.add_enabled(enabled, egui::DragValue::new(&mut v).range(-180.0..=180.0).suffix("°").max_decimals(1));+ if r.changed() {+ set(d, path, json!(v));+ }+ });+}++/// InDesign's angle dial: a circle with a radius pointing where the light comes from (0° to the+/// right, counter-clockwise). A click or a drag on it points it at the pointer.+fn angle_dial(ui: &mut egui::Ui, deg: f64, enabled: bool) -> Option<f64> {+ let sense = if enabled { egui::Sense::click_and_drag() } else { egui::Sense::hover() };+ let (r, resp) = ui.allocate_exact_size(egui::vec2(26.0, 26.0), sense);+ resp.widget_info(|| egui::WidgetInfo::slider(enabled, deg, "Angle"));+ let col = if enabled { ui.visuals().text_color() } else { ui.visuals().weak_text_color() };+ let (c, rad) = (r.center(), 11.0);+ ui.painter().circle_stroke(c, rad, egui::Stroke::new(1.2, col));+ let a = deg.to_radians() as f32;+ ui.painter().line_segment([c, c + egui::vec2(a.cos(), -a.sin()) * rad], egui::Stroke::new(1.4, col));+ if enabled && (resp.dragged() || resp.clicked()) {+ return resp.interact_pointer_pos().and_then(|p| dial_angle(c, p));}+ None+}++/// The angle a dial at `c` points at for the pointer at `p`, in whole degrees (−180 to 180,+/// counter-clockwise from the right); none too close to the centre to tell.+fn dial_angle(c: egui::Pos2, p: egui::Pos2) -> Option<f64> {+ let d = p - c;+ // Straight left is 180° (not −180°, which a negative zero would give).+ (d.length() > 2.0).then(|| f64::from((-d.y).atan2(d.x)).to_degrees().round()).map(|a| if a <= -180.0 { 180.0 } else { a })}fn flag(ui: &mut egui::Ui, d: &mut Dialog, path: &[&str], label: &str) {@@ -725,6 +756,19 @@ mod tests {assert!(!fx(&app).inner_shadow.on);}+ /// The angle dial points where the pointer is, as InDesign's: right is 0°, up 90°, left 180°,+ /// down −90°, upper left 135°.+ #[test]+ fn the_angle_dial_points_at_the_pointer() {+ let c = egui::pos2(100.0, 100.0);+ assert_eq!(dial_angle(c, egui::pos2(120.0, 100.0)), Some(0.0));+ assert_eq!(dial_angle(c, egui::pos2(100.0, 80.0)), Some(90.0));+ assert_eq!(dial_angle(c, egui::pos2(80.0, 100.0)), Some(180.0));+ assert_eq!(dial_angle(c, egui::pos2(100.0, 120.0)), Some(-90.0));+ assert_eq!(dial_angle(c, egui::pos2(90.0, 90.0)), Some(135.0));+ assert_eq!(dial_angle(c, egui::pos2(101.0, 100.0)), None, "too close to the centre");+ }+#[test]fn offsets_follow_distance_and_angle_as_in_indesign() {let (mut app, _) = app_with_frame();