From 8f1d89467a73aedd6a1d7616b3c9c3f4eec3b2af Mon Sep 17 00:00:00 2001 From: Mario Buikhuizen Date: Tue, 11 Apr 2023 15:19:09 +0200 Subject: [PATCH] Backport PR #1598: fix: resize not always working --- js/src/Figure.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/src/Figure.ts b/js/src/Figure.ts index 6b5191c67..8e6c8db85 100644 --- a/js/src/Figure.ts +++ b/js/src/Figure.ts @@ -76,10 +76,10 @@ export class Figure extends DOMWidgetView { this.intersectObserver = new IntersectionObserver( (entries: IntersectionObserverEntry[]) => { - if (entries[0].isIntersecting) { + if (entries[entries.length - 1].isIntersecting) { this.visible = true; this.debouncedRelayout(); - } else if (entries[0].rootBounds != null) { + } else if (entries[entries.length - 1].rootBounds != null) { /* When 'rootBounds' is null, 'isIntersecting' is 'false', but the plot is visible, so only change 'visible' * if rootBonds is set. I can't find any info on this behaviour. */ this.visible = false;