diff --git a/docs/automation-graph.html b/docs/automation-graph.html
index 05f1d23f..9b34bcbb 100644
--- a/docs/automation-graph.html
+++ b/docs/automation-graph.html
@@ -1200,16 +1200,26 @@ document.getElementById('btn-clear').addEventListener('click', () => {
const LEGEND_STORAGE_KEY = 'liderra-map-legend-width';
const LEGEND_MIN_W = 300, LEGEND_MAX_W = 900;
+let redrawScheduled = false;
function applyLegendWidth(w) {
const clamped = Math.max(LEGEND_MIN_W, Math.min(LEGEND_MAX_W, w));
const panel = document.getElementById('legend-panel');
panel.style.width = clamped + 'px';
panel.style.minWidth = clamped + 'px';
- if (typeof network !== 'undefined' && network) network.redraw();
+ if (typeof network !== 'undefined' && network && !redrawScheduled) {
+ redrawScheduled = true;
+ requestAnimationFrame(() => {
+ redrawScheduled = false;
+ network.redraw();
+ });
+ }
}
function restoreLegendWidth() {
- const saved = parseInt(localStorage.getItem(LEGEND_STORAGE_KEY) || '300', 10);
+ let saved = 300;
+ try {
+ saved = parseInt(localStorage.getItem(LEGEND_STORAGE_KEY) || '300', 10);
+ } catch (e) { /* private mode or quota — keep default */ }
applyLegendWidth(saved);
}
@@ -1234,7 +1244,7 @@ function restoreLegendWidth() {
handle.classList.remove('dragging');
document.body.style.userSelect = '';
const w = parseInt(document.getElementById('legend-panel').style.width, 10);
- localStorage.setItem(LEGEND_STORAGE_KEY, String(w));
+ try { localStorage.setItem(LEGEND_STORAGE_KEY, String(w)); } catch (e) { /* private mode or quota */ }
});
})();