From 19e78a07b7aa350282ecfbe87ecb4b71f01ac16f Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue, 30 Jul 2024 19:30:47 +1000 Subject: [PATCH] fix(ui): use pixel bbox when image is in layer --- .../web/src/features/controlLayers/konva/CanvasLayer.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/invokeai/frontend/web/src/features/controlLayers/konva/CanvasLayer.ts b/invokeai/frontend/web/src/features/controlLayers/konva/CanvasLayer.ts index 19adc309cb..3a2bdfeae0 100644 --- a/invokeai/frontend/web/src/features/controlLayers/konva/CanvasLayer.ts +++ b/invokeai/frontend/web/src/features/controlLayers/konva/CanvasLayer.ts @@ -618,14 +618,16 @@ export class CanvasLayer { * - Eraser lines are normal lines, except they composite as transparency. Konva's getClientRect includes them when * calculating the bbox. * - Clipped portions of lines will be included in the client rect. + * - Images have transparency, so they will be included in the client rect. * * TODO(psyche): Using pixel data is slow. Is it possible to be clever and somehow subtract the eraser lines and * clipped areas from the client rect? */ for (const obj of this.objects.values()) { const isEraserLine = obj instanceof CanvasEraserLine; + const isImage = obj instanceof CanvasImage; const hasClip = obj instanceof CanvasBrushLine && obj.state.clip; - if (isEraserLine || hasClip) { + if (isEraserLine || hasClip || isImage) { needsPixelBbox = true; break; }