From 61f7fa11ab997a8e384547093a2a52c7dbe0122d Mon Sep 17 00:00:00 2001 From: Steve Ruiz Date: Sat, 16 Oct 2021 21:06:29 +0100 Subject: [PATCH] Fix bug on sticky --- .../state/session/sessions/translate/translate.session.ts | 6 +++++- packages/tldraw/src/state/tool/StickyTool/StickyTool.ts | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/tldraw/src/state/session/sessions/translate/translate.session.ts b/packages/tldraw/src/state/session/sessions/translate/translate.session.ts index fb344678b..f37efcbda 100644 --- a/packages/tldraw/src/state/session/sessions/translate/translate.session.ts +++ b/packages/tldraw/src/state/session/sessions/translate/translate.session.ts @@ -288,7 +288,9 @@ export class TranslateSession implements Session { afterShapes[shape.id] = { ...afterShapes[shape.id], - point: TLDR.getShape(data, shape.id, pageId).point, + ...(this.isCreate + ? TLDR.getShape(data, shape.id, pageId) + : { point: TLDR.getShape(data, shape.id, pageId).point }), } }) } @@ -326,6 +328,8 @@ export class TranslateSession implements Session { } }) + console.log(afterShapes) + return { id: 'translate', before: { diff --git a/packages/tldraw/src/state/tool/StickyTool/StickyTool.ts b/packages/tldraw/src/state/tool/StickyTool/StickyTool.ts index c2451cf0a..787918fd7 100644 --- a/packages/tldraw/src/state/tool/StickyTool/StickyTool.ts +++ b/packages/tldraw/src/state/tool/StickyTool/StickyTool.ts @@ -58,8 +58,9 @@ export class StickyTool extends BaseTool { onPointerUp: TLPointerEventHandler = () => { if (this.status === Status.Creating) { - this.state.completeSession() this.setStatus(Status.Idle) + this.state.completeSession() + this.state.selectTool('select') this.state.setEditingId(this.shapeId) } }