From 32bbdc2248fa4affba7b0ba92b60910a6e724a24 Mon Sep 17 00:00:00 2001 From: DiTus Date: Sun, 1 Mar 2026 22:51:29 +0100 Subject: [PATCH] fixed: default pane height 120px, save to localStorage on resize --- .../static/js/ui/indicators-panel-new.js | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/api/dashboard/static/js/ui/indicators-panel-new.js b/src/api/dashboard/static/js/ui/indicators-panel-new.js index 0465fbf..ca04106 100644 --- a/src/api/dashboard/static/js/ui/indicators-panel-new.js +++ b/src/api/dashboard/static/js/ui/indicators-panel-new.js @@ -650,7 +650,7 @@ function addIndicator(type) { plots: metadata.plots, series: [], visible: true, - paneHeight: Math.floor(window.innerHeight * 0.2) // default 20% of screen + paneHeight: 120 // default 120px }); // Don't set configuringId so indicators are NOT expanded by default @@ -954,10 +954,26 @@ export function drawIndicatorsOnChart() { const pane = window.dashboard.chart.panes()[paneIndex]; if (pane) { - // Use stored height or default to 20% of chart height - const defaultHeight = Math.floor(window.innerHeight * 0.2); - const storedHeight = indicator.paneHeight || defaultHeight; + // Use stored height, localStorage, or default 120px + const storedHeight = indicator.paneHeight || + parseInt(localStorage.getItem(`pane_height_${indicator.type}`)) || + 120; pane.setHeight(storedHeight); + + // Subscribe to pane height changes to save to localStorage + const currentPane = pane; + const originalHeight = storedHeight; + const resizeObserver = new ResizeObserver((entries) => { + for (const entry of entries) { + const newHeight = Math.round(entry.contentRect.height); + if (newHeight !== originalHeight && newHeight > 50) { + indicator.paneHeight = newHeight; + localStorage.setItem(`pane_height_${indicator.type}`, newHeight); + console.log(`[Indicators] Saved pane height for ${indicator.type}: ${newHeight}px`); + } + } + }); + resizeObserver.observe(pane.domNode()); } });