mirror of
https://github.com/JannisX11/blockbench.git
synced 2025-04-06 17:31:09 +08:00
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:
parent
774ef189e1
commit
d766cd1678
@ -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();
|
||||
|
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user