From 029ee903517403d438ff53b40f1bf6c261bea971 Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu, 9 May 2024 14:12:39 +1000 Subject: [PATCH] docs(ui): add comment & TODO for konva bug --- .../web/src/features/controlLayers/util/renderers.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/invokeai/frontend/web/src/features/controlLayers/util/renderers.ts b/invokeai/frontend/web/src/features/controlLayers/util/renderers.ts index b74fef80c5..a652c6753b 100644 --- a/invokeai/frontend/web/src/features/controlLayers/util/renderers.ts +++ b/invokeai/frontend/web/src/features/controlLayers/util/renderers.ts @@ -483,6 +483,9 @@ const updateInitialImageLayerImageAttrs = ( konvaImage: Konva.Image, reduxLayer: InitialImageLayer ) => { + // Konva erroneously reports NaN for width and height when the stage is hidden. This causes errors when caching, + // but it doesn't seem to break anything. + // TODO(psyche): Investigate and report upstream. const newWidth = stage.width() / stage.scaleX(); const newHeight = stage.height() / stage.scaleY(); if ( @@ -618,6 +621,9 @@ const updateControlNetLayerImageAttrs = ( reduxLayer: ControlAdapterLayer ) => { let needsCache = false; + // Konva erroneously reports NaN for width and height when the stage is hidden. This causes errors when caching, + // but it doesn't seem to break anything. + // TODO(psyche): Investigate and report upstream. const newWidth = stage.width() / stage.scaleX(); const newHeight = stage.height() / stage.scaleY(); const hasFilter = konvaImage.filters() !== null && konvaImage.filters().length > 0;