bumps perfect-freehand, improves draw dots
This commit is contained in:
parent
4c39e19543
commit
840532142e
4 changed files with 14 additions and 12 deletions
|
@ -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)',
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
},
|
||||
|
|
|
@ -37,13 +37,10 @@ export class Draw extends TLDrawShapeUtil<DrawShape> {
|
|||
|
||||
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<DrawShape> {
|
|||
)
|
||||
}
|
||||
|
||||
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) {
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue