From 04572c94ad7af0bf5a71e3438022baccec715c2e Mon Sep 17 00:00:00 2001 From: Attila Cseh Date: Tue, 5 Aug 2025 08:51:38 +0200 Subject: [PATCH] setting bbox visibility moved into render method --- .../controlLayers/konva/CanvasTool/CanvasBboxToolModule.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/invokeai/frontend/web/src/features/controlLayers/konva/CanvasTool/CanvasBboxToolModule.ts b/invokeai/frontend/web/src/features/controlLayers/konva/CanvasTool/CanvasBboxToolModule.ts index 017609f76e..10f12f0c18 100644 --- a/invokeai/frontend/web/src/features/controlLayers/konva/CanvasTool/CanvasBboxToolModule.ts +++ b/invokeai/frontend/web/src/features/controlLayers/konva/CanvasTool/CanvasBboxToolModule.ts @@ -198,7 +198,7 @@ export class CanvasBboxToolModule extends CanvasModuleBase { this.subscriptions.add(this.manager.$isBusy.listen(this.render)); // Listen for stage changes to update the bbox's visibility - this.subscriptions.add(this.$isBboxHidden.listen((isHidden) => this.konva.group.visible(!isHidden))); + this.subscriptions.add(this.$isBboxHidden.listen(this.render)); } // This is a noop. The cursor is changed when the cursor enters or leaves the bbox. @@ -214,13 +214,15 @@ export class CanvasBboxToolModule extends CanvasModuleBase { }; /** - * Renders the bbox. The bbox is only visible when the tool is set to 'bbox'. + * Renders the bbox. */ render = () => { const tool = this.manager.tool.$tool.get(); const { x, y, width, height } = this.manager.stateApi.runSelector(selectBbox).rect; + this.konva.group.visible(!this.$isBboxHidden.get()); + // We need to reach up to the preview layer to enable/disable listening so that the bbox can be interacted with. // If the mangaer is busy, we disable listening so the bbox cannot be interacted with. this.konva.group.listening(tool === 'bbox' && !this.manager.$isBusy.get());