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
|
||||
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`);
|
||||
const paneElement = pane.getHTMLElement && pane.getHTMLElement();
|
||||
if (paneElement) {
|
||||
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.getHTMLElement());
|
||||
});
|
||||
resizeObserver.observe(paneElement);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user