tweaks to dashes
This commit is contained in:
parent
c49b2e684a
commit
a9db0dbe23
5 changed files with 13 additions and 6 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
## 0.0.111
|
||||||
|
|
||||||
|
### TLDraw
|
||||||
|
|
||||||
|
- Adjust stroke widths and sizes.
|
||||||
|
- Fixes a bug on very small dashed shapes.
|
||||||
|
|
||||||
## 0.0.110
|
## 0.0.110
|
||||||
|
|
||||||
### Core
|
### Core
|
||||||
|
|
|
@ -139,9 +139,9 @@ export function getPerfectDashProps(
|
||||||
|
|
||||||
dashes -= dashes % snap
|
dashes -= dashes % snap
|
||||||
|
|
||||||
if (dashes < 4) dashes = 4
|
dashes = Math.max(dashes, 4)
|
||||||
|
|
||||||
const gapLength = (length - dashes * dashLength) / dashes
|
const gapLength = Math.max(strokeWidth * 2, (length - dashes * dashLength) / dashes)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
strokeDasharray: [dashLength, gapLength].join(' '),
|
strokeDasharray: [dashLength, gapLength].join(' '),
|
||||||
|
|
|
@ -105,7 +105,7 @@ export const Arrow = new ShapeUtil<ArrowShape, SVGSVGElement, TLDrawMeta>(() =>
|
||||||
|
|
||||||
const { strokeDasharray, strokeDashoffset } = getPerfectDashProps(
|
const { strokeDasharray, strokeDashoffset } = getPerfectDashProps(
|
||||||
arrowDist,
|
arrowDist,
|
||||||
sw,
|
strokeWidth * 1.618,
|
||||||
shape.style.dash,
|
shape.style.dash,
|
||||||
2
|
2
|
||||||
)
|
)
|
||||||
|
@ -155,7 +155,7 @@ export const Arrow = new ShapeUtil<ArrowShape, SVGSVGElement, TLDrawMeta>(() =>
|
||||||
: getArrowArcPath(start, end, circle, shape.bend)
|
: getArrowArcPath(start, end, circle, shape.bend)
|
||||||
|
|
||||||
const { strokeDasharray, strokeDashoffset } = getPerfectDashProps(
|
const { strokeDasharray, strokeDashoffset } = getPerfectDashProps(
|
||||||
length - 1,
|
Math.abs(length),
|
||||||
sw,
|
sw,
|
||||||
shape.style.dash,
|
shape.style.dash,
|
||||||
2
|
2
|
||||||
|
|
|
@ -89,7 +89,7 @@ export const Ellipse = new ShapeUtil<EllipseShape, SVGSVGElement, TLDrawMeta>(()
|
||||||
|
|
||||||
const { strokeDasharray, strokeDashoffset } = getPerfectDashProps(
|
const { strokeDasharray, strokeDashoffset } = getPerfectDashProps(
|
||||||
perimeter < 64 ? perimeter * 2 : perimeter,
|
perimeter < 64 ? perimeter * 2 : perimeter,
|
||||||
sw,
|
strokeWidth * 1.618,
|
||||||
shape.style.dash,
|
shape.style.dash,
|
||||||
4
|
4
|
||||||
)
|
)
|
||||||
|
|
|
@ -87,7 +87,7 @@ export const Rectangle = new ShapeUtil<RectangleShape, SVGSVGElement, TLDrawMeta
|
||||||
const paths = strokes.map(([start, end, length], i) => {
|
const paths = strokes.map(([start, end, length], i) => {
|
||||||
const { strokeDasharray, strokeDashoffset } = getPerfectDashProps(
|
const { strokeDasharray, strokeDashoffset } = getPerfectDashProps(
|
||||||
length,
|
length,
|
||||||
sw,
|
strokeWidth * 1.618,
|
||||||
shape.style.dash
|
shape.style.dash
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue