mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-30 04:37:29 -06:00
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:
@@ -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`]).
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user