mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-28 19:57:05 -06:00
M1.5: commands that default to the current layer validate the remembered id (reused after undo it could name a compound path: Send to Current Layer moved art into it, Delete Layer could delete it)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
1e7b4308ec
commit
13d0aef57f
@@ -138,6 +138,10 @@ impl DocState {
|
||||
.unwrap_or_else(|| self.doc.title.clone())
|
||||
}
|
||||
/// Where new art is inserted: the isolation container, else the active layer.
|
||||
/// The current layer, if the remembered id still names a layer (ids are reused after undo).
|
||||
pub fn current_layer(&self) -> Option<NodeId> {
|
||||
self.active_layer.filter(|l| self.doc.node(*l).is_some_and(|n| n.is_layer()))
|
||||
}
|
||||
pub fn insertion_parent(&self) -> Option<NodeId> {
|
||||
// Ids are reused after undo (the id counter is part of the document), so a remembered
|
||||
// layer or isolated group must still be one: a pasted group must never land in a path.
|
||||
|
||||
Reference in New Issue
Block a user