diff --git a/packages/core/src/hooks/useStyle.tsx b/packages/core/src/hooks/useStyle.tsx index 52874ef2e..abd6970c1 100644 --- a/packages/core/src/hooks/useStyle.tsx +++ b/packages/core/src/hooks/useStyle.tsx @@ -69,7 +69,7 @@ const defaultTheme: TLTheme = { brushFill: 'rgba(0,0,0,.05)', brushStroke: 'rgba(0,0,0,.25)', selectStroke: 'rgb(66, 133, 244)', - selectFill: 'rgba(65, 132, 244, 0.12)', + selectFill: 'rgba(65, 132, 244, 0.05)', background: 'rgb(248, 249, 250)', foreground: 'rgb(51, 51, 51)', } diff --git a/packages/tldraw/package.json b/packages/tldraw/package.json index c011f21d3..5f49f982a 100644 --- a/packages/tldraw/package.json +++ b/packages/tldraw/package.json @@ -55,7 +55,7 @@ "@stitches/react": "^0.2.3", "@tldraw/core": "^0.0.49", "ismobilejs": "^1.1.1", - "perfect-freehand": "^0.4.10", + "perfect-freehand": "^0.5.1", "react-hotkeys-hook": "^3.4.0", "zustand": "^3.5.7" }, diff --git a/packages/tldraw/src/shape/shapes/draw/draw.tsx b/packages/tldraw/src/shape/shapes/draw/draw.tsx index 82c633613..dbc625927 100644 --- a/packages/tldraw/src/shape/shapes/draw/draw.tsx +++ b/packages/tldraw/src/shape/shapes/draw/draw.tsx @@ -37,13 +37,10 @@ export class Draw extends TLDrawShapeUtil { const strokeWidth = styles.strokeWidth - const shouldFill = - style.isFilled && - points.length > 3 && - Vec.dist(points[0], points[points.length - 1]) < +styles.strokeWidth * 2 - // For very short lines, draw a point instead of a line - if (points.length === 1) { + const bounds = this.getBounds(shape) + + if (!isEditing && bounds.width < strokeWidth / 2 && bounds.height < strokeWidth / 2) { const sw = strokeWidth * 0.618 return ( @@ -57,6 +54,11 @@ export class Draw extends TLDrawShapeUtil { ) } + const shouldFill = + style.isFilled && + points.length > 3 && + Vec.dist(points[0], points[points.length - 1]) < +styles.strokeWidth * 2 + // For drawn lines, draw a line from the path cache if (shape.style.dash === DashStyle.Draw) { diff --git a/yarn.lock b/yarn.lock index 397c2dd95..a40d7229a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8003,10 +8003,10 @@ pbkdf2@^3.0.3: safe-buffer "^5.0.1" sha.js "^2.4.8" -perfect-freehand@^0.4.10: - version "0.4.10" - resolved "https://registry.yarnpkg.com/perfect-freehand/-/perfect-freehand-0.4.10.tgz#f866bc4700c854f26a3eaf75254661f08dd1c9af" - integrity sha512-AizjryguXVA7BRflfTkteUPCFaPAhz7PCeNBANMZ78Dy5mq/YCePHV0uT1Vn3W6Mnk9SyYwvJMFrpTnph+Sk8g== +perfect-freehand@^0.5.1: + version "0.5.1" + resolved "https://registry.yarnpkg.com/perfect-freehand/-/perfect-freehand-0.5.1.tgz#871b1d2d02e731f90dd609d20f153ee9fa48db71" + integrity sha512-5lbnulrJwarVYhdhuCl1PbIRAGg3MrYmaBU08Fs2GetL9nS23KPFPP+ilV1vHPeI6Jv+264mMwkO3yZlzEQ6dA== performance-now@^2.1.0: version "2.1.0"