From f4de2fd3b1327b42453bb5e9f902fd188bff939f Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue, 6 Aug 2024 13:37:41 +1000 Subject: [PATCH] fix(ui): no objects rendered until vis toggled --- .../src/features/controlLayers/konva/CanvasInpaintMask.ts | 2 +- .../web/src/features/controlLayers/konva/CanvasLayer.ts | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/invokeai/frontend/web/src/features/controlLayers/konva/CanvasInpaintMask.ts b/invokeai/frontend/web/src/features/controlLayers/konva/CanvasInpaintMask.ts index bbc80b0f8c..bcc1ebc14d 100644 --- a/invokeai/frontend/web/src/features/controlLayers/konva/CanvasInpaintMask.ts +++ b/invokeai/frontend/web/src/features/controlLayers/konva/CanvasInpaintMask.ts @@ -117,6 +117,6 @@ export class CanvasInpaintMask { updateVisibility = (arg?: { isEnabled: boolean }) => { this.log.trace('Updating visibility'); const isEnabled = get(arg, 'isEnabled', this.state.isEnabled); - this.konva.layer.visible(isEnabled && this.renderer.hasObjects()); + this.konva.layer.visible(isEnabled); }; } diff --git a/invokeai/frontend/web/src/features/controlLayers/konva/CanvasLayer.ts b/invokeai/frontend/web/src/features/controlLayers/konva/CanvasLayer.ts index 194c87984c..11caef1bb0 100644 --- a/invokeai/frontend/web/src/features/controlLayers/konva/CanvasLayer.ts +++ b/invokeai/frontend/web/src/features/controlLayers/konva/CanvasLayer.ts @@ -70,6 +70,9 @@ export class CanvasLayer { this.log.debug('Updating'); const { position, objects, opacity, isEnabled } = state; + if (this.isFirstRender || isEnabled !== this.state.isEnabled) { + this.updateVisibility({ isEnabled }); + } if (this.isFirstRender || objects !== this.state.objects) { await this.updateObjects({ objects }); } @@ -79,9 +82,6 @@ export class CanvasLayer { if (this.isFirstRender || opacity !== this.state.opacity) { this.updateOpacity({ opacity }); } - if (this.isFirstRender || isEnabled !== this.state.isEnabled) { - this.updateVisibility({ isEnabled }); - } // this.transformer.syncInteractionState(); if (this.isFirstRender) { @@ -95,7 +95,7 @@ export class CanvasLayer { updateVisibility = (arg?: { isEnabled: boolean }) => { this.log.trace('Updating visibility'); const isEnabled = get(arg, 'isEnabled', this.state.isEnabled); - this.konva.layer.visible(isEnabled && this.renderer.hasObjects()); + this.konva.layer.visible(isEnabled); }; updateObjects = async (arg?: { objects: CanvasLayerState['objects'] }) => {