From e78cf889ee5f55296eb1a302bc4c7bd608ea2c6f Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu, 20 Mar 2025 14:53:56 +1000 Subject: [PATCH] fix(ui): clip shift-draw strokes to bbox when clip to bbox enabled Closes #7809 --- .../konva/CanvasTool/CanvasBrushToolModule.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/invokeai/frontend/web/src/features/controlLayers/konva/CanvasTool/CanvasBrushToolModule.ts b/invokeai/frontend/web/src/features/controlLayers/konva/CanvasTool/CanvasBrushToolModule.ts index d6c4dea450..5404622cc4 100644 --- a/invokeai/frontend/web/src/features/controlLayers/konva/CanvasTool/CanvasBrushToolModule.ts +++ b/invokeai/frontend/web/src/features/controlLayers/konva/CanvasTool/CanvasBrushToolModule.ts @@ -301,8 +301,9 @@ export class CanvasBrushToolModule extends CanvasModuleBase { points, strokeWidth: settings.brushWidth, color: this.manager.stateApi.getCurrentColor(), - // When shift is held, the line may extend beyond the clip region. No clip for these lines. - clip: isShiftDraw ? null : this.parent.getClip(selectedEntity.state), + // When shift is held, the line may extend beyond the clip region. Clip only if we are clipping to bbox. If we + // are clipping to stage, we don't need to clip at all. + clip: isShiftDraw && !settings.clipToBbox ? null : this.parent.getClip(selectedEntity.state), }); } else { const lastLinePoint = getLastPointOfLastLine(selectedEntity.state.objects, 'brush_line'); @@ -325,8 +326,9 @@ export class CanvasBrushToolModule extends CanvasModuleBase { points, strokeWidth: settings.brushWidth, color: this.manager.stateApi.getCurrentColor(), - // When shift is held, the line may extend beyond the clip region. No clip for these lines. - clip: isShiftDraw ? null : this.parent.getClip(selectedEntity.state), + // When shift is held, the line may extend beyond the clip region. Clip only if we are clipping to bbox. If we + // are clipping to stage, we don't need to clip at all. + clip: isShiftDraw && !settings.clipToBbox ? null : this.parent.getClip(selectedEntity.state), }); } };