allow dark mode changes to be immediate and not require page reload
This commit is contained in:
parent
afc26d1db0
commit
c4bee0b762
3 changed files with 20 additions and 11 deletions
|
|
@ -88,7 +88,6 @@
|
|||
function booleanSave() {
|
||||
let control = settings().controller;
|
||||
let isDark = control.dark;
|
||||
let isReload = false;
|
||||
control.expert = UI.expert.checked;
|
||||
control.showOrigin = UI.showOrigin.checked;
|
||||
control.autoLayout = UI.autoLayout.checked;
|
||||
|
|
@ -104,14 +103,8 @@
|
|||
platform.layout();
|
||||
platform.update_stock();
|
||||
API.conf.save();
|
||||
// if dark mode changed, reload UI
|
||||
if (isDark !== control.dark) {
|
||||
isReload = true;
|
||||
}
|
||||
API.mode.set_expert(control.expert);
|
||||
if (isReload) {
|
||||
API.space.reload();
|
||||
}
|
||||
API.platform.update_size();
|
||||
}
|
||||
|
||||
function onLayerToggle() {
|
||||
|
|
|
|||
|
|
@ -1017,10 +1017,12 @@
|
|||
if (ctrl.dark) {
|
||||
SPACE.platform.setGrid(gridMajor, gridMinor, 0x999999, 0x333333);
|
||||
SPACE.platform.opacity(0.8);
|
||||
SPACE.setSkyColor(0);
|
||||
DOC.body.classList.add('dark');
|
||||
} else {
|
||||
SPACE.platform.setGrid(gridMajor, gridMinor, 0x999999, 0xcccccc);
|
||||
SPACE.platform.opacity(0.3);
|
||||
SPACE.setSkyColor(0xffffff);
|
||||
DOC.body.classList.remove('dark');
|
||||
}
|
||||
SPACE.platform.setGZOff(height/2 - 0.1);
|
||||
|
|
|
|||
Loading…
Reference in a new issue