Object: Lock, Hide, Unlock All and Show All are off in an object isolated inside pattern or opacity mask editing

Pattern editing mode and opacity mask editing allow these commands only
while their own layer is the isolated one.
This commit is contained in:
dotCooCoo
2026-10-29 10:12:16 +07:00
committed by bflatastic
parent a6a850868c
commit f715b9a1a5
2 changed files with 8 additions and 6 deletions
+4 -6
View File
@@ -181,14 +181,12 @@ pub fn has_multi(s: &Session) -> std::result::Result<(), String> {
}
/// A document is open and it is not in isolation mode: Object › Lock's and Object › Hide's items,
/// Unlock All and Show All are off in isolation mode. Pattern editing mode and opacity mask
/// editing isolate their art too, and do not count as isolation mode here.
/// editing isolate their art too, and do not count as isolation mode here while their own layer
/// is the isolated one. An object isolated inside them counts.
pub fn outside_isolation(s: &Session) -> std::result::Result<(), String> {
let st = s.active().ok_or("no document open")?;
if st.isolation.is_some() && st.doc.pattern_edit.is_none() && st.doc.mask_edit.is_none() {
Err("exit isolation mode first".into())
} else {
Ok(())
}
let editing_layer = |l| st.doc.pattern_edit.as_ref().is_some_and(|e| e.layer == l) || st.doc.mask_edit.as_ref().is_some_and(|e| e.layer == l);
if st.isolation.is_some_and(|l| !editing_layer(l)) { Err("exit isolation mode first".into()) } else { Ok(()) }
}
/// Objects are selected ([`has_selection`]) and the document is not in isolation mode
/// ([`outside_isolation`]).
+4
View File
@@ -381,6 +381,10 @@ fn unlock_all_and_show_all_are_off_in_isolation_mode() {
assert!(!node(&s, tile[0]).visible, "hidden in pattern editing mode");
s.execute("object.showAll", &json!({})).unwrap();
assert!(node(&s, tile[0]).visible, "shown in pattern editing mode");
// An object isolated inside pattern editing mode is isolation mode again.
s.execute("object.isolate", &json!({"id": tile[0].0})).unwrap();
sel(&mut s, &[tile[0]]);
off_in_isolation(&mut s, &["object.unlockAll", "object.showAll"]);
s.execute("object.pattern.cancel", &json!({})).unwrap();
// Opacity mask editing: the mask's art locks and unlocks again.