Dock shortcuts

This commit is contained in:
Mo Bitar
2018-12-12 18:37:07 -06:00
parent 1877412ebf
commit 7cba67ce69
6 changed files with 120 additions and 12 deletions

View File

@@ -631,22 +631,33 @@ class ComponentManager {
}
handleToggleComponentMessage(sourceComponent, targetComponent, message) {
if(targetComponent.area == "modal") {
this.openModalComponent(targetComponent);
this.toggleComponent(targetComponent);
}
toggleComponent(component) {
if(component.area == "modal") {
this.openModalComponent(component);
} else {
if(targetComponent.active) {
this.deactivateComponent(targetComponent);
if(component.active) {
this.deactivateComponent(component);
} else {
if(targetComponent.content_type == "SN|Theme" && !targetComponent.isLayerable()) {
if(component.content_type == "SN|Theme") {
// Deactive currently active theme if new theme is not layerable
var activeThemes = this.getActiveThemes();
for(var theme of activeThemes) {
if(theme && !theme.isLayerable()) {
this.deactivateComponent(theme);
}
// Activate current before deactivating others, so as not to flicker
this.activateComponent(component);
if(!component.isLayerable()) {
setTimeout(() => {
for(var theme of activeThemes) {
if(theme && !theme.isLayerable()) {
this.deactivateComponent(theme);
}
}
}, 10);
}
}
this.activateComponent(targetComponent);
}
}
}