2021-05-22 21:35:25 +02:00
|
|
|
import ButtonWidget from "./button_widget.js";
|
2021-05-24 22:29:49 +02:00
|
|
|
import options from "../../services/options.js";
|
|
|
|
import splitService from "../../services/split.js";
|
2021-05-22 21:35:25 +02:00
|
|
|
|
2021-06-03 22:23:11 +02:00
|
|
|
export default class LeftPaneToggleWidget extends ButtonWidget {
|
2021-05-22 21:35:25 +02:00
|
|
|
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();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|