Tweaks arrow offset code

pull/71/head
Steve Ruiz 2021-08-13 13:24:49 +01:00
rodzic e161d027a4
commit 63ef272b57
2 zmienionych plików z 6 dodań i 6 usunięć

Wyświetl plik

@ -32,7 +32,7 @@ esbuild
if (isDevServer) {
serve.start({
port: 3000,
port: 5000,
root: './dist',
live: true,
})

Wyświetl plik

@ -597,13 +597,13 @@ export class Arrow extends TLDrawShapeUtil<ArrowShape> {
const offset = [bounds.minX, bounds.minY]
nextShape.handles = Object.fromEntries(
Object.entries(nextShape.handles).map(([key, handle]) => {
return [key, { ...handle, point: Vec.add(handle.point, Vec.neg(offset)) }]
if (!Vec.isEqual(offset, [0, 0])) {
Object.values(nextShape.handles).forEach((handle) => {
handle.point = Vec.round(Vec.sub(handle.point, offset))
})
) as ArrowShape['handles']
nextShape.point = Vec.add(nextShape.point, offset)
nextShape.point = Vec.round(Vec.add(nextShape.point, offset))
}
return nextShape
}