diff --git a/src/public/app/services/load_results.ts b/src/public/app/services/load_results.ts index 0f96cee93..27b3b1eb9 100644 --- a/src/public/app/services/load_results.ts +++ b/src/public/app/services/load_results.ts @@ -1,3 +1,4 @@ +import type { OptionNames } from "../../../services/options_interface.js"; import type { AttributeType } from "../entities/fattribute.js"; import type { EntityChange } from "../server_types.js"; @@ -182,7 +183,7 @@ export default class LoadResults { this.optionNames.push(name); } - isOptionReloaded(name: string) { + isOptionReloaded(name: OptionNames) { return this.optionNames.includes(name); } diff --git a/src/public/app/services/resizer.ts b/src/public/app/services/resizer.ts index d6e828047..5ebd48de8 100644 --- a/src/public/app/services/resizer.ts +++ b/src/public/app/services/resizer.ts @@ -31,14 +31,12 @@ function setupLeftPaneResizer(leftPaneVisible: boolean) { } } -function setupRightPaneResizer() { +function setupRightPaneResizer(rightPaneVisible: boolean) { if (rightInstance) { rightInstance.destroy(); rightInstance = null; } - const rightPaneVisible = $("#right-pane").is(":visible"); - if (!rightPaneVisible) { $("#center-pane").css("width", "100%"); diff --git a/src/public/app/widgets/buttons/right_pane_toggle.ts b/src/public/app/widgets/buttons/right_pane_toggle.ts index 212635a2c..9b1d0442f 100644 --- a/src/public/app/widgets/buttons/right_pane_toggle.ts +++ b/src/public/app/widgets/buttons/right_pane_toggle.ts @@ -1,4 +1,7 @@ +import splitService from "../../services/resizer.js"; +import options from "../../services/options.js"; import CommandButtonWidget from "./command_button.js"; +import type { EventData } from "../../components/app_context.js"; export default class RightPaneToggleWidget extends CommandButtonWidget { @@ -11,4 +14,16 @@ export default class RightPaneToggleWidget extends CommandButtonWidget { this.settings.command = "toggleRightPane"; } + refreshIcon(): void { + super.refreshIcon(); + + splitService.setupRightPaneResizer(options.is("rightPaneVisible")); + } + + entitiesReloadedEvent({ loadResults }: EventData<"entitiesReloaded">) { + if (loadResults.isOptionReloaded("rightPaneVisible")) { + this.refreshIcon(); + } + } + } diff --git a/src/public/app/widgets/containers/right_pane_container.ts b/src/public/app/widgets/containers/right_pane_container.ts index 8761f7cfd..575082748 100644 --- a/src/public/app/widgets/containers/right_pane_container.ts +++ b/src/public/app/widgets/containers/right_pane_container.ts @@ -36,16 +36,7 @@ export default class RightPaneContainer extends FlexContainer } reEvaluateRightPaneVisibilityCommand() { - const newToggle = this.isEnabled(); - - if (newToggle) { - this.toggleInt(newToggle); - - splitService.setupRightPaneResizer(); - console.log("Toggle on") - } else { - console.log("Toggle of") - } + this.toggleInt(this.isEnabled()); } entitiesReloadedEvent({ loadResults }: EventData<"entitiesReloaded">) {