transfer-out: transfer out

This commit is contained in:
alex 2023-04-25 12:01:25 +01:00
parent ec84f64e63
commit 29ed921c67
1056 changed files with 154507 additions and 0 deletions

View file

@ -0,0 +1,39 @@
import { Box2d } from '@tldraw/primitives'
import { getPerfectDashProps } from './getPerfectDashProps'
export function DashedOutlineBox({
bounds,
zoomLevel,
className,
}: {
bounds: Box2d
zoomLevel: number
className: string
}) {
return (
<g className={className} pointerEvents="none" strokeLinecap="round" strokeLinejoin="round">
{bounds.sides.map((side, i) => {
const { strokeDasharray, strokeDashoffset } = getPerfectDashProps(
side[0].dist(side[1]),
1 / zoomLevel,
{
style: 'dashed',
lengthRatio: 4,
}
)
return (
<line
key={i}
x1={side[0].x}
y1={side[0].y}
x2={side[1].x}
y2={side[1].y}
strokeDasharray={strokeDasharray}
strokeDashoffset={strokeDashoffset}
/>
)
})}
</g>
)
}