mirror of
https://github.com/JannisX11/blockbench.git
synced 2024-11-21 01:13:37 +08:00
Add Reset Layout to help menu
Make Reset Layout unfold panels
This commit is contained in:
parent
30eea82b43
commit
d96c9daa4b
@ -936,18 +936,7 @@ BARS.defineActions(function() {
|
|||||||
|
|
||||||
for (let id in Panels) {
|
for (let id in Panels) {
|
||||||
let panel = Panels[id];
|
let panel = Panels[id];
|
||||||
|
panel.resetCustomLayout();
|
||||||
if (!Interface.data.panels[id]) Interface.data.panels[id] = {};
|
|
||||||
panel.position_data = Interface.data.panels[id];
|
|
||||||
|
|
||||||
let defaultp = panel.default_position || 0;
|
|
||||||
if (!panel.position_data.slot) panel.position_data.slot = defaultp.slot || 'left_bar';
|
|
||||||
if (!panel.position_data.float_position)panel.position_data.float_position = defaultp.float_position || [0, 0];
|
|
||||||
if (!panel.position_data.float_size) panel.position_data.float_size = defaultp.float_size || [300, 300];
|
|
||||||
if (!panel.position_data.height) panel.position_data.height = defaultp.height || 300;
|
|
||||||
if (panel.position_data.folded == undefined) panel.position_data.folded = defaultp.folded || false;
|
|
||||||
|
|
||||||
panel.moveTo(panel.slot);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Blockbench.dispatchEvent('reset_layout', {});
|
Blockbench.dispatchEvent('reset_layout', {});
|
||||||
|
@ -459,6 +459,7 @@ const MenuBar = {
|
|||||||
singleButton: true
|
singleButton: true
|
||||||
}).show();
|
}).show();
|
||||||
}},
|
}},
|
||||||
|
'reset_layout',
|
||||||
{name: 'menu.help.developer.reset_storage', icon: 'fas.fa-hdd', click: () => {
|
{name: 'menu.help.developer.reset_storage', icon: 'fas.fa-hdd', click: () => {
|
||||||
if (confirm(tl('menu.help.developer.reset_storage.confirm'))) {
|
if (confirm(tl('menu.help.developer.reset_storage.confirm'))) {
|
||||||
localStorage.clear()
|
localStorage.clear()
|
||||||
|
@ -334,7 +334,19 @@ class Panel extends EventSystem {
|
|||||||
this.position_data.folded = !!state;
|
this.position_data.folded = !!state;
|
||||||
}
|
}
|
||||||
resetCustomLayout() {
|
resetCustomLayout() {
|
||||||
|
if (!Interface.data.panels[this.id]) Interface.data.panels[this.id] = {};
|
||||||
|
this.position_data = Interface.data.panels[this.id];
|
||||||
|
|
||||||
|
let defaultp = this.default_position || 0;
|
||||||
|
if (!this.position_data.slot) this.position_data.slot = defaultp.slot || 'left_bar';
|
||||||
|
if (!this.position_data.float_position) this.position_data.float_position = defaultp.float_position || [0, 0];
|
||||||
|
if (!this.position_data.float_size) this.position_data.float_size = defaultp.float_size || [300, 300];
|
||||||
|
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;
|
||||||
|
|
||||||
|
this.moveTo(this.slot);
|
||||||
|
this.fold(this.folded);
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
addToolbar(toolbar, position = this.toolbars.length) {
|
addToolbar(toolbar, position = this.toolbars.length) {
|
||||||
let nodes = [];
|
let nodes = [];
|
||||||
|
Loading…
Reference in New Issue
Block a user