Fix issue where undoing a selection of a deleted element would create invalid state

Make tool config API match type
This commit is contained in:
JannisX11 2025-01-30 01:06:48 +01:00
parent 774ef189e1
commit d766cd1678
2 changed files with 4 additions and 1 deletions

View File

@ -687,6 +687,7 @@ window.ToolConfig = class ToolConfig extends Dialog {
}
save() {
localStorage.setItem(`tool_config.${this.id}`, JSON.stringify(this.options));
return this;
}
changeOptions(options) {
for (let key in options) {
@ -696,6 +697,7 @@ window.ToolConfig = class ToolConfig extends Dialog {
this.form.setValues(options);
}
this.save();
return this;
}
close(button, event) {
this.save();
@ -712,6 +714,7 @@ window.ToolConfig = class ToolConfig extends Dialog {
this.object.style.top = (anchor_position.top+anchor.offsetHeight) + 'px';
this.object.style.left = Math.clamp(anchor_position.left - 30, 0, window.innerWidth-this.object.clientWidth - (this.title ? 0 : 30)) + 'px';
}
return this;
}
build() {
if (this.object) this.object.remove();

View File

@ -854,7 +854,7 @@ UndoSystem.selectionSave = class {
unselectAllElements();
if (this.elements) {
Outliner.selected.replace(this.elements.map(uuid => OutlinerNode.uuids[uuid]));
Outliner.selected.replace(this.elements.map(uuid => OutlinerNode.uuids[uuid]).filter(element => element instanceof OutlinerElement));
}
if (this.groups) {
for (let uuid of this.groups) {