Fix Reset Layout not working with panel changes

This commit is contained in:
JannisX11 2023-11-25 18:39:02 +01:00
parent 1fd58f2d17
commit 8a43a16f6b
2 changed files with 10 additions and 2 deletions

View File

@ -350,6 +350,11 @@ class Panel extends EventSystem {
if (!this.position_data.height) this.position_data.height = defaultp.height || 300;
if (this.position_data.folded == undefined) this.position_data.folded = defaultp.folded || false;
for (let mode_id in Interface.data.modes) {
let mode_data = Interface.getModeData(mode_id);
if (!mode_data.panels[this.id]) mode_data.panels[this.id] = JSON.parse(JSON.stringify(this.position_data));
}
this.moveTo(this.slot);
this.fold(this.folded);
return this;
@ -538,8 +543,7 @@ class Panel extends EventSystem {
return this;
}
updateSlot() {
let position_data = this.position_data;
let {slot} = position_data;
let slot = this.slot;
this.node.classList.remove('floating');

View File

@ -63,7 +63,11 @@ class Mode extends KeybindItem {
UVEditor.beforeMoving();
for (let id in Panels) {
let old_pos_data = Panels[id].position_data;
Panels[id].position_data = Interface.getModeData().panels[id];
if (!Panels[id].position_data) {
Panels[id].position_data = Interface.getModeData().panels[id] = JSON.parse(JSON.stringify(old_pos_data))
}
Panels[id].updateSlot();
}
updateSidebarOrder();