Guides: Lock Guides locks the paths made into guides too (part of #1534)

This commit is contained in:
Marco Arnulfo
2026-10-13 08:51:38 +07:00
committed by bflatastic
parent 05e321f4e0
commit 79b5d73ca7
3 changed files with 37 additions and 2 deletions
+4 -2
View File
@@ -489,8 +489,10 @@ fn release_guides(s: &mut Session, _: &Value) -> Result<Value> {
fn lock_guides(s: &mut Session, p: &Value) -> Result<Value> {
let v = p.get("locked").and_then(Value::as_bool).unwrap_or(!s.menu.guides_locked);
s.menu.guides_locked = v;
// Locked guides can't stay selected.
if v && !s.doc()?.selection.guides.is_empty() {
// Locked guides can't stay selected, ruler guides or guide paths ([`Session::select`] lets
// those go).
let st = s.doc()?;
if v && (!st.selection.guides.is_empty() || st.selection.objects.iter().any(|id| crate::is_guide_path(&st.doc, *id))) {
s.select(|_, sel| sel.guides.clear())?;
}
Ok(json!({ "locked": v }))