docs(ui): add comment & TODO for konva bug

This commit is contained in:
psychedelicious 2024-05-09 14:12:39 +10:00 committed by Kent Keirsey
parent 2f9a064d48
commit 029ee90351

View File

@ -483,6 +483,9 @@ const updateInitialImageLayerImageAttrs = (
konvaImage: Konva.Image, konvaImage: Konva.Image,
reduxLayer: InitialImageLayer 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 newWidth = stage.width() / stage.scaleX();
const newHeight = stage.height() / stage.scaleY(); const newHeight = stage.height() / stage.scaleY();
if ( if (
@ -618,6 +621,9 @@ const updateControlNetLayerImageAttrs = (
reduxLayer: ControlAdapterLayer reduxLayer: ControlAdapterLayer
) => { ) => {
let needsCache = false; 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 newWidth = stage.width() / stage.scaleX();
const newHeight = stage.height() / stage.scaleY(); const newHeight = stage.height() / stage.scaleY();
const hasFilter = konvaImage.filters() !== null && konvaImage.filters().length > 0; const hasFilter = konvaImage.filters() !== null && konvaImage.filters().length > 0;