From a9236bcbb05abea00ec254d37ceab6e8f65949f0 Mon Sep 17 00:00:00 2001 From: alex Date: Thu, 5 Oct 2023 13:31:36 +0100 Subject: [PATCH] fix screen bounds not updating (#2022) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There are a lot of cases (eg when interacting with the ui) where the editor loses focus. This check was preventing us from updating the viewport screen bounds when appropriate. This function is throttled and pretty cheap anyway (if the viewport is equal its a no-op) so let's just remove the condition ### Change Type - [x] `patch` — Bug fix --- packages/editor/src/lib/hooks/useScreenBounds.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/editor/src/lib/hooks/useScreenBounds.ts b/packages/editor/src/lib/hooks/useScreenBounds.ts index 447cd4692..b456fea55 100644 --- a/packages/editor/src/lib/hooks/useScreenBounds.ts +++ b/packages/editor/src/lib/hooks/useScreenBounds.ts @@ -8,9 +8,7 @@ export function useScreenBounds() { useLayoutEffect(() => { const updateBounds = throttle( () => { - if (editor.instanceState.isFocused) { - editor.updateViewportScreenBounds() - } + editor.updateViewportScreenBounds() }, 200, {