From 525bdccd911eabfeee65a31b434dc33a1fada7da Mon Sep 17 00:00:00 2001 From: nathan Date: Fri, 14 Jun 2024 10:34:09 -0600 Subject: [PATCH] Framework WIP: - Fix app side slot initial width did not load / incorrect preferences --- kdots/js/EgwFrameworkApp.ts | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/kdots/js/EgwFrameworkApp.ts b/kdots/js/EgwFrameworkApp.ts index d14011363d..7fc35c3848 100644 --- a/kdots/js/EgwFrameworkApp.ts +++ b/kdots/js/EgwFrameworkApp.ts @@ -442,27 +442,27 @@ export class EgwFrameworkApp extends LitElement return; } - // Skip if there's no side-content - if(!this.hasSideContent(event.target.panelInfo.side)) - { - return; - } + let panelInfo = event.target.panelInfo; + + await this.loadingPromise; // Left side is in pixels, round to 2 decimals - let newPosition = Math.round(event.target.panelInfo.side == "left" ? event.target.positionInPixels * 100 : event.target.position * 100) / 100; + let newPosition = Math.round(panelInfo.side == "left" ? event.target.positionInPixels * 100 : Math.max(100, event.target.position) * 100) / 100; // Update collapsed - this[`${event.target.panelInfo.side}Collapsed`] = newPosition == event.target.panelInfo.hiddenWidth; + this[`${panelInfo.side}Collapsed`] = newPosition == panelInfo.hiddenWidth; - let preferenceName = event.target.panelInfo.preference; - if(newPosition != event.target.panelInfo.preferenceWidth && !isNaN(newPosition)) + let preferenceName = panelInfo.preference; + let currentPreference = parseFloat("" + await this.egw.preference(preferenceName, this.name, true)); + + if(newPosition != currentPreference && !isNaN(newPosition)) { - event.target.panelInfo.preferenceWidth = newPosition; - if(this.resizeTimeout) + panelInfo.preferenceWidth = newPosition; + if(panelInfo.resizeTimeout) { - window.clearTimeout(this.resizeTimeout); + window.clearTimeout(panelInfo.resizeTimeout); } - this.resizeTimeout = window.setTimeout(() => + panelInfo.resizeTimeout = window.setTimeout(() => { this.egw.set_preference(this.name, preferenceName, newPosition);