Skip to content

Commit 04572c9

Browse files
Attila Csehpsychedelicious
authored andcommitted
setting bbox visibility moved into render method
1 parent 1e9e780 commit 04572c9

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

invokeai/frontend/web/src/features/controlLayers/konva/CanvasTool/CanvasBboxToolModule.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ export class CanvasBboxToolModule extends CanvasModuleBase {
198198
this.subscriptions.add(this.manager.$isBusy.listen(this.render));
199199

200200
// Listen for stage changes to update the bbox's visibility
201-
this.subscriptions.add(this.$isBboxHidden.listen((isHidden) => this.konva.group.visible(!isHidden)));
201+
this.subscriptions.add(this.$isBboxHidden.listen(this.render));
202202
}
203203

204204
// 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 {
214214
};
215215

216216
/**
217-
* Renders the bbox. The bbox is only visible when the tool is set to 'bbox'.
217+
* Renders the bbox.
218218
*/
219219
render = () => {
220220
const tool = this.manager.tool.$tool.get();
221221

222222
const { x, y, width, height } = this.manager.stateApi.runSelector(selectBbox).rect;
223223

224+
this.konva.group.visible(!this.$isBboxHidden.get());
225+
224226
// We need to reach up to the preview layer to enable/disable listening so that the bbox can be interacted with.
225227
// If the mangaer is busy, we disable listening so the bbox cannot be interacted with.
226228
this.konva.group.listening(tool === 'bbox' && !this.manager.$isBusy.get());

0 commit comments

Comments
 (0)