From 6dcb7607e4499227ea6de4e8d68f7495ef92fb6c Mon Sep 17 00:00:00 2001 From: Igor Zinken <730069+igorski@users.noreply.github.com> Date: Tue, 7 Apr 2026 21:49:27 +0200 Subject: [PATCH] Pixel brushes now draw directly on pointer down for single click paint operations --- src/rendering/operations/drawing.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/rendering/operations/drawing.ts b/src/rendering/operations/drawing.ts index 8a5660f..1f86f8b 100644 --- a/src/rendering/operations/drawing.ts +++ b/src/rendering/operations/drawing.ts @@ -57,7 +57,11 @@ export const renderBrushStroke = ( ctx: CanvasRenderingContext2D, brush: Brush, } if ( pointers.length < 2 ) { - return lastIndex; + if ( type === BrushTypes.PIXEL && pointers.length === 1 ) { + pointers.push({ ...pointers[ 0 ] }); // pixel brushes draw on "first contact" + } else { + return lastIndex; + } } const lineWidth = getSizeForBrush( brush ) * scale; @@ -110,9 +114,6 @@ export const renderBrushStroke = ( ctx: CanvasRenderingContext2D, brush: Brush, if ( type === BrushTypes.PIXEL ) { ctx.fillStyle = brush.colors[ 0 ]; - if ( isFirst ) { - ctx.fillRect( Math.floor( prevPoint.x ), Math.floor( prevPoint.y ), 1, 1 ); - } ctx.fillRect( Math.floor( point.x ), Math.floor( point.y ), 1, 1 ); continue; }