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";
|
2022-12-02 16:46:14 +01:00
|
|
|
import CommandButtonWidget from "./command_button.js";
|
2021-05-22 21:35:25 +02:00
|
|
|
|
2022-12-02 16:46:14 +01:00
|
|
|
export default class LeftPaneToggleWidget extends CommandButtonWidget {
|
|
|
|
constructor() {
|
|
|
|
super();
|
2021-05-22 21:35:25 +02:00
|
|
|
|
2022-12-11 13:20:37 +01:00
|
|
|
this.class("launcher-button");
|
|
|
|
|
2022-12-02 16:46:14 +01:00
|
|
|
this.settings.icon = () => options.is('leftPaneVisible')
|
2021-05-22 21:35:25 +02:00
|
|
|
? "bx-chevrons-left"
|
|
|
|
: "bx-chevrons-right";
|
|
|
|
|
2022-12-02 16:46:14 +01:00
|
|
|
this.settings.title = () => options.is('leftPaneVisible')
|
2022-07-05 06:06:45 -05:00
|
|
|
? "Hide panel"
|
|
|
|
: "Open panel";
|
2021-05-22 21:35:25 +02:00
|
|
|
|
2022-12-02 16:46:14 +01:00
|
|
|
this.settings.command = () => options.is('leftPaneVisible')
|
2021-10-12 19:29:42 +02:00
|
|
|
? "hideLeftPane"
|
|
|
|
: "showLeftPane";
|
2022-12-02 16:46:14 +01:00
|
|
|
}
|
2021-05-22 21:35:25 +02:00
|
|
|
|
2022-12-02 16:46:14 +01:00
|
|
|
refreshIcon() {
|
2021-05-22 21:35:25 +02:00
|
|
|
super.refreshIcon();
|
|
|
|
|
2022-12-02 16:46:14 +01:00
|
|
|
splitService.setupLeftPaneResizer(options.is('leftPaneVisible'));
|
2021-05-22 21:35:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
entitiesReloadedEvent({loadResults}) {
|
|
|
|
if (loadResults.isOptionReloaded("leftPaneVisible")) {
|
|
|
|
this.refreshIcon();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|