fixed: check pane element exists before observing
This commit is contained in:
@ -962,17 +962,20 @@ export function drawIndicatorsOnChart() {
|
|||||||
|
|
||||||
// Subscribe to pane height changes to save to localStorage
|
// Subscribe to pane height changes to save to localStorage
|
||||||
const originalHeight = storedHeight;
|
const originalHeight = storedHeight;
|
||||||
const resizeObserver = new ResizeObserver((entries) => {
|
const paneElement = pane.getHTMLElement && pane.getHTMLElement();
|
||||||
for (const entry of entries) {
|
if (paneElement) {
|
||||||
const newHeight = Math.round(entry.contentRect.height);
|
const resizeObserver = new ResizeObserver((entries) => {
|
||||||
if (newHeight !== originalHeight && newHeight > 50) {
|
for (const entry of entries) {
|
||||||
indicator.paneHeight = newHeight;
|
const newHeight = Math.round(entry.contentRect.height);
|
||||||
localStorage.setItem(`pane_height_${indicator.type}`, newHeight);
|
if (newHeight !== originalHeight && newHeight > 50) {
|
||||||
console.log(`[Indicators] Saved pane height for ${indicator.type}: ${newHeight}px`);
|
indicator.paneHeight = newHeight;
|
||||||
|
localStorage.setItem(`pane_height_${indicator.type}`, newHeight);
|
||||||
|
console.log(`[Indicators] Saved pane height for ${indicator.type}: ${newHeight}px`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
resizeObserver.observe(paneElement);
|
||||||
resizeObserver.observe(pane.getHTMLElement());
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user