forked from 1b-agent/opencadstudio-upstream
fix(model): preserve solid history lifecycle
This commit is contained in:
1 parent
d2993fd054
commit
4ac10187c2
15 files changed
+292
-63
No files matched your search
+14
-2
@@ -189,6 +189,7 @@ impl OpenCADStudio {
|
||||
i: usize,
|
||||
label: impl Into<String>,
|
||||
before: Vec<(Handle, Arc<EntityType>)>,
|
||||
object_before: Vec<(Handle, acadrust::objects::ObjectType)>,
|
||||
dirty_before: bool,
|
||||
) {
|
||||
self.finish_pending_history(i);
|
||||
@@ -199,7 +200,18 @@ impl OpenCADStudio {
|
||||
Some((handle, Some(original), Some(after)))
|
||||
})
|
||||
.collect();
|
||||
if entities.is_empty() {
|
||||
let objects: Vec<_> = object_before
|
||||
.into_iter()
|
||||
.filter_map(|(handle, before)| {
|
||||
let after = self.tabs[i].scene.document.objects.get(&handle).cloned();
|
||||
(Some(before.clone()) != after).then_some(ObjectEntryDelta {
|
||||
handle,
|
||||
before: Some(before),
|
||||
after,
|
||||
})
|
||||
})
|
||||
.collect();
|
||||
if entities.is_empty() && objects.is_empty() {
|
||||
return;
|
||||
}
|
||||
let selected: Vec<Handle> = self.tabs[i].scene.selected.iter().copied().collect();
|
||||
@@ -211,7 +223,7 @@ impl OpenCADStudio {
|
||||
selected_after: selected,
|
||||
dirty_before,
|
||||
dirty_after: true,
|
||||
structure: None,
|
||||
structure: (!objects.is_empty()).then_some(StructureSnapshot::Objects(objects)),
|
||||
label: label.into(),
|
||||
};
|
||||
self.push_undo_entry(i, HistorySnapshot::Delta(delta));
|
||||
|
||||
Reference in new issue
Block a user