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";
|
2021-06-05 14:01:21 +02:00
|
|
|
import splitService from "../../services/resizer.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
|
2021-10-12 19:29:42 +02:00
|
|
|
? "Hide panel."
|
|
|
|
: "Open panel.";
|
2021-05-22 21:35:25 +02:00
|
|
|
|
|
|
|
this.settings.command = isLeftPaneVisible
|
2021-10-12 19:29:42 +02:00
|
|
|
? "hideLeftPane"
|
|
|
|
: "showLeftPane";
|
2021-05-22 21:35:25 +02:00
|
|
|
|
|
|
|
super.refreshIcon();
|
|
|
|
|
2021-06-05 14:01:21 +02:00
|
|
|
splitService.setupLeftPaneResizer(isLeftPaneVisible);
|
2021-05-22 21:35:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
entitiesReloadedEvent({loadResults}) {
|
|
|
|
if (loadResults.isOptionReloaded("leftPaneVisible")) {
|
|
|
|
this.refreshIcon();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|