From 734268e2cd61cc0383f5aca9a560f7082e6ea516 Mon Sep 17 00:00:00 2001 From: trafficlunar Date: Fri, 24 Jan 2025 16:11:28 +0000 Subject: [PATCH] fix: rectangle-select tool is off by one when selecting on radius of 1 --- src/components/canvas/Canvas.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/canvas/Canvas.tsx b/src/components/canvas/Canvas.tsx index 5bc8df1..82481d7 100644 --- a/src/components/canvas/Canvas.tsx +++ b/src/components/canvas/Canvas.tsx @@ -267,7 +267,7 @@ function Canvas() { const startY = Math.min(dragStartCoords.y, mouseCoords.y); const endY = Math.max(dragStartCoords.y, mouseCoords.y); - const isRadiusEven = radius % 2 == 0; + const isRadiusEven = radius == 1 || radius % 2 == 0; for (let x = startX; x < endX + (isRadiusEven ? radius : radius - 1); x++) { for (let y = startY; y < endY + (isRadiusEven ? radius : radius - 1); y++) {