fix(sidebar): split being visible when collapsed

This commit is contained in:
Elian Doran 2025-01-19 20:47:06 +02:00
parent d74c5ea2a1
commit 1893f2ea80
No known key found for this signature in database
4 changed files with 19 additions and 14 deletions

View File

@ -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);
}

View File

@ -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%");

View File

@ -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();
}
}
}

View File

@ -36,16 +36,7 @@ export default class RightPaneContainer extends FlexContainer<RightPanelWidget>
}
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">) {