From 5071cffb021371fcbea12da598b462eef28b7799 Mon Sep 17 00:00:00 2001 From: Christopher Chedeau Date: Sun, 6 Dec 2020 03:42:04 -0800 Subject: [PATCH] Fix scrollbars when no elements (#2460) I already fixed this but a special case for no elements was added in getCommonBounds to return 0 and reintroduce this bug. I'm not exactly sure where to put this check tbh. Fixing it here so that I'm not annoyed anymore at least. I checked some of the callsites, some of them related to selection will never pass an empty array, some to export will break if we remove the 0, 0, 0, 0 fix. --- src/scene/scrollbars.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/scene/scrollbars.ts b/src/scene/scrollbars.ts index 91e3a627..24f10e7d 100644 --- a/src/scene/scrollbars.ts +++ b/src/scene/scrollbars.ts @@ -23,6 +23,12 @@ export const getScrollBars = ( zoom: Zoom; }, ): ScrollBars => { + if (elements.length === 0) { + return { + horizontal: null, + vertical: null, + }; + } // This is the bounding box of all the elements const [ elementsMinX,