Skip to content

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

fix(paths): Join Path and Convert Point leave paths on locked layers and in locked groups unchanged

aiongg27025e5245b0
diff --git a/ROADMAP.md b/ROADMAP.md
index d60a6bf49..86063f778 100644
--- a/ROADMAP.md
+++ b/ROADMAP.md
@@ -347,6 +347,7 @@ list) · [roadmap.md](docs/roadmap.md) (milestones, plan) · [parity-checklist.m
Newest first.
+- **2026-10-15** · Join Path and Convert Point leave a path on a locked layer or inside a locked group unchanged, as the other path edits do. No readiness percentage change.
- **2026-10-14** · The Type tool draws a new text frame over a locked empty frame, as InDesign does, instead of turning the locked frame into a text frame. No readiness percentage change.
- **2026-10-14** · 100% black shows as pure black on screen by default, as InDesign's Appearance of Black does out of the box (Display All Blacks as Rich Black); Preferences › Appearance of Black › Display All Blacks Accurately still shows it as the dark grey it prints, and a saved choice is kept. No readiness percentage change.
- **2026-10-14** · Pathfinder keeps the frontmost object, as InDesign does: a photo placed over shapes and intersected with them shows through the shapes (it was dropped, and the shapes kept their black fill); Add, Exclude Overlap and Minus Back take the front object's fill too, Subtract still keeps the back one. No readiness percentage change.
diff --git a/crates/engine/src/cmd/anchors.rs b/crates/engine/src/cmd/anchors.rs
index c6e285200..f2225c480 100644
--- a/crates/engine/src/cmd/anchors.rs
+++ b/crates/engine/src/cmd/anchors.rs
@@ -82,8 +82,13 @@ pub fn specs() -> Vec<CommandSpec> {
fn join_paths(s: &mut Session, p: &Value) -> Result<Value> {
let ids = super::targets(s, p)?;
s.edit(|d, sel| {
- let ids: Vec<ItemId> =
- ids.iter().copied().filter(|id| d.item(*id).is_some_and(|it| !it.locked && !it.is_group() && it.text_frame().is_none())).collect();
+ let paths: Vec<ItemId> = ids.iter().copied().filter(|id| d.item(*id).is_some_and(|it| !it.is_group() && it.text_frame().is_none())).collect();
+ let ids: Vec<ItemId> = paths.iter().copied().filter(|id| path_editable(d, *id, "path.join").is_ok()).collect();
+ if ids.is_empty()
+ && let Some(id) = paths.first()
+ {
+ path_editable(d, *id, "path.join")?;
+ }
let open = |d: &Document, id: ItemId| d.item(id).and_then(|it| it.path.subpaths.iter().position(|sp| !sp.closed && sp.anchors.len() > 1));
match ids.as_slice() {
[id] => {
@@ -162,11 +167,16 @@ fn convert_points(s: &mut Session, p: &Value) -> Result<Value> {
}
s.edit(|d, _| {
let mut converted = 0;
+ let mut refused = None;
for (id, si, ai) in &points {
- let Some(it) = d.item_mut(*id) else { continue };
- if it.locked || it.is_group() {
+ if d.item(*id).is_none_or(|it| it.is_group()) {
+ continue;
+ }
+ if let Err(e) = path_editable(d, *id, "path.convertPoints") {
+ refused.get_or_insert(e);
continue;
}
+ let Some(it) = d.item_mut(*id) else { continue };
let Some(sp) = it.path.subpaths.get_mut(*si) else { continue };
let Some(a) = sp.anchors.get(*ai).copied() else { continue };
let auto = smooth_auto(&sp.anchors, *ai, sp.closed);
@@ -194,6 +204,9 @@ fn convert_points(s: &mut Session, p: &Value) -> Result<Value> {
}
as_path(&mut it.shape);
}
+ if let (0, Some(e)) = (converted, refused) {
+ return Err(e);
+ }
Ok(json!({"converted": converted}))
})
}
diff --git a/crates/engine/src/cmd/object.rs b/crates/engine/src/cmd/object.rs
index bbc0a36a1..a05024388 100644
--- a/crates/engine/src/cmd/object.rs
+++ b/crates/engine/src/cmd/object.rs
@@ -3404,6 +3404,8 @@ mod path_edit_tests {
("path.erase", json!({"id": id, "points": [[120, 100], [180, 100]]})),
("path.smooth", json!({"id": id, "points": [[120, 100], [180, 100]]})),
("path.split", json!({"id": id, "at": [150, 100]})),
+ ("path.join", json!({"ids": [id]})),
+ ("path.convertPoints", json!({"ids": [id], "kind": "corner"})),
]
}