From b1002b70e93e82c5f23b283bf6cd01330e6ca1d1 Mon Sep 17 00:00:00 2001 From: Steve Ruiz Date: Tue, 16 Nov 2021 21:04:00 +0000 Subject: [PATCH] Round points when a draw shape is completed --- .../tldraw/src/state/sessions/DrawSession/DrawSession.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/tldraw/src/state/sessions/DrawSession/DrawSession.ts b/packages/tldraw/src/state/sessions/DrawSession/DrawSession.ts index fb800fbe4..b5605cc5e 100644 --- a/packages/tldraw/src/state/sessions/DrawSession/DrawSession.ts +++ b/packages/tldraw/src/state/sessions/DrawSession/DrawSession.ts @@ -170,6 +170,8 @@ export class DrawSession extends BaseSession { const { shapeId } = this const pageId = this.app.currentPageId + const shape = this.app.getShape(shapeId) + return { id: 'create_draw', before: { @@ -194,7 +196,9 @@ export class DrawSession extends BaseSession { [pageId]: { shapes: { [shapeId]: { - ...this.app.getShape(shapeId), + ...shape, + point: Vec.round(shape.point), + points: shape.points.map((pt) => Vec.round(pt)), isComplete: true, }, },