fix(scene): isolate drawing-space state

Cancel stale interaction state across space changes and keep live previews and zoom extents in their active paper/model context.\n\nRefs #539\nRefs #540\nRefs #541
This commit is contained in:
Hakan Seven committed 2026-07-28 18:51:20 +03:00
1 parent 8050fc79fd
commit 00cc17ea55
10 files changed
+424 -96

No files matched your search

+12
View File
@@ -848,6 +848,9 @@ pub enum CmdResult {
ReplaceMany(Vec<(Handle, Vec<EntityType>)>, Vec<EntityType>),
/// Cancel: discard any preview and end the command.
Cancel,
/// Cancel because the active drawing space changed. Cleanup is identical
/// to `Cancel`, but the host reports the context change explicitly.
CancelForSpaceChange,
/// End the selection-gather phase and re-dispatch the named command
/// with the gathered handles installed as the active scene selection.
Relaunch(String, Vec<Handle>),
@@ -1279,6 +1282,15 @@ pub trait CadCommand: Send {
CmdResult::Cancel
}
/// Abort because the active drawing coordinate space is about to change.
/// Unlike `on_escape`, the default never interprets cancellation as
/// "finish with the points collected so far" (SPLINE does that for a
/// deliberate Escape). Commands owning a live document entity can
/// override this to close that entity's deferred history safely.
fn on_space_change(&mut self) -> CmdResult {
CmdResult::Cancel
}
/// Returns `true` when the command needs entity picking (hit-test) instead of point picking.
fn needs_entity_pick(&self) -> bool {
false