From a8545c5f31200d2d58696223c5050cbf9cf553ae Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Mon, 11 Jan 2021 13:35:56 -0500
Subject: from last

---
 src/client/views/nodes/PresBox.tsx | 19 ++++---------------
 1 file changed, 4 insertions(+), 15 deletions(-)

(limited to 'src/client/views/nodes/PresBox.tsx')

diff --git a/src/client/views/nodes/PresBox.tsx b/src/client/views/nodes/PresBox.tsx
index fb3598a04..271a7274f 100644
--- a/src/client/views/nodes/PresBox.tsx
+++ b/src/client/views/nodes/PresBox.tsx
@@ -774,33 +774,22 @@ export class PresBox extends ViewBoxBaseComponent<FieldViewProps, PresBoxSchema>
         if (doc.presPinView || doc.presentationTargetDoc === this.layoutDoc.presCollection) setTimeout(() => this.updateCurrentPresentation(context), 0);
         else this.updateCurrentPresentation(context);
 
-
-
         if (this.targetDoc.isInkMask) {
             if (this.activeItem.y !== undefined &&
                 this.activeItem.x !== undefined &&
                 this.targetDoc.y !== undefined &&
                 this.targetDoc.y !== undefined) {
                 const timer = (ms: number) => new Promise(res => this._presTimer = setTimeout(res, ms));
-
-                const ydiff = this.activeItem.y - this.targetDoc.y;
-                const xdiff = this.activeItem.x - this.targetDoc.x;
-
                 const time = 10;
-
-                const yOffset = ydiff / time;
-                const xOffset = xdiff / time;
+                const ydiff = NumCast(this.activeItem.y) - NumCast(this.targetDoc.y);
+                const xdiff = NumCast(this.activeItem.x) - NumCast(this.targetDoc.x);
 
                 for (let i = 0; i < time; i++) {
-                    const newy = Number(this.targetDoc.y) + yOffset;
-                    const newx = Number(this.targetDoc.x) + xOffset;
-                    this.targetDoc.y = newy;
-                    this.targetDoc.x = newx;
+                    this.targetDoc.x = NumCast(this.targetDoc.x) + xdiff / time;
+                    this.targetDoc.y = NumCast(this.targetDoc.y) + ydiff / time;
                     await timer(0.1);
                 }
-
             }
-
         }
     }
 
-- 
cgit v1.2.3-70-g09d2

