refactoring of pane => split, "pane" keeps its old meaning (left-pane, center-pane, right-pane)

This commit is contained in:
zadam
2021-06-03 22:23:11 +02:00
parent ac04be4433
commit 2bfd7b844c
12 changed files with 42 additions and 45 deletions

View File

@@ -0,0 +1,39 @@
import ButtonWidget from "./button_widget.js";
import options from "../../services/options.js";
import splitService from "../../services/split.js";
export default class LeftPaneToggleWidget extends ButtonWidget {
refreshIcon() {
const isLeftPaneVisible = options.is('leftPaneVisible');
this.settings.icon = isLeftPaneVisible
? "bx-chevrons-left"
: "bx-chevrons-right";
this.settings.title = isLeftPaneVisible
? "Hide sidebar."
: "Open sidebar.";
this.settings.command = isLeftPaneVisible
? "hideSidebar"
: "showSidebar";
super.refreshIcon();
splitService.setupSplit(isLeftPaneVisible);
}
hideSidebarCommand() {
options.save(`leftPaneVisible`, "false");
}
showSidebarCommand() {
options.save(`leftPaneVisible`, "true");
}
entitiesReloadedEvent({loadResults}) {
if (loadResults.isOptionReloaded("leftPaneVisible")) {
this.refreshIcon();
}
}
}