fixes in side pane toggling

This commit is contained in:
zadam 2020-03-01 20:11:40 +01:00
parent 9c631e4398
commit 4e0e2e8926
3 changed files with 7 additions and 15 deletions

View File

@ -2,7 +2,7 @@ import options from "./options.js";
let instance;
async function setupSplit(left, right) {
function setupSplit(left, right) {
if (instance) {
instance.destroy();
instance = null;

View File

@ -15,16 +15,8 @@ export default class SidePaneContainer extends FlexContainer {
return super.isEnabled() && options.is(this.side + 'PaneVisible');
}
handleEvent(name, data) {
if (options.is(this.side + 'PaneVisible')) {
super.handleEvent(name, data);
}
}
sidebarVisibilityChangedEvent({side, show}) {
if (this.side === side) {
this.toggle(show);
if (this.side === side && show) {
this.handleEvent('lazyLoaded');
}
}

View File

@ -38,9 +38,6 @@ export default class SidePaneToggles extends BasicWidget {
doRender() {
this.$widget = $(TPL);
this.toggleSidebar('left', options.is('leftPaneVisible'));
this.toggleSidebar('right', options.is('rightPaneVisible'));
this.$widget.find(".show-right-pane-button").on('click', () => this.toggleAndSave('right', true));
this.$widget.find(".hide-right-pane-button").on('click', () => this.toggleAndSave('right', false));
@ -59,16 +56,19 @@ export default class SidePaneToggles extends BasicWidget {
}
async toggleAndSave(side, show) {
this.toggleSidebar(side, show);
await options.save(`${side}PaneVisible`, show.toString());
this.toggleSidebar(side, show);
splitService.setupSplit(this.paneVisible.left, this.paneVisible.right);
this.triggerEvent('sidebarVisibilityChanged', {side, show});
}
initialRenderCompleteEvent() {
this.toggleSidebar('left', options.is('leftPaneVisible'));
this.toggleSidebar('right', options.is('rightPaneVisible'));
splitService.setupSplit(this.paneVisible.left, this.paneVisible.right);
}
}