From 3ca852f483e0868975678d3db97d72d637d8414c Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Sun, 3 Apr 2022 01:03:38 -0400
Subject: fixed ink handles to work in lightbox, so re-enabled open in lightbox
 for selected ink.  fixed double-click to not lock out in some cases because
 pendingDoubleClick never gets unset.  fixed text to not jitter scroll bar
 when typing enter at end of autosize texst box.

---
 src/client/views/InkTangentHandles.tsx | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

(limited to 'src/client/views/InkTangentHandles.tsx')

diff --git a/src/client/views/InkTangentHandles.tsx b/src/client/views/InkTangentHandles.tsx
index ab73e58a4..b15e4260d 100644
--- a/src/client/views/InkTangentHandles.tsx
+++ b/src/client/views/InkTangentHandles.tsx
@@ -29,8 +29,10 @@ export class InkTangentHandles extends React.Component<InkHandlesProps> {
      * @param handleNum The index of the currently selected handle point.
      */
     onHandleDown = (e: React.PointerEvent, handleIndex: number): void => {
-        var controlUndo: UndoManager.Batch | undefined;
+        const ptFromScreen = this.props.inkView.ComponentView?.ptFromScreen;
+        if (!ptFromScreen) return;
         const screenScale = this.props.ScreenToLocalTransform().Scale;
+        var controlUndo: UndoManager.Batch | undefined;
         const order = handleIndex % 4;
         const oppositeHandleRawIndex = order === 1 ? handleIndex - 3 : handleIndex + 3;
         const oppositeHandleIndex = (oppositeHandleRawIndex < 0 ? this.props.screenCtrlPoints.length + oppositeHandleRawIndex : oppositeHandleRawIndex) % this.props.screenCtrlPoints.length;
@@ -39,7 +41,9 @@ export class InkTangentHandles extends React.Component<InkHandlesProps> {
             (e: PointerEvent, down: number[], delta: number[]) => {
                 if (!controlUndo) controlUndo = UndoManager.StartBatch("DocDecs move tangent");
                 if (e.altKey) this.onBreakTangent(controlIndex);
-                InkStrokeProperties.Instance.moveTangentHandle(this.props.inkView, -delta[0] * screenScale, -delta[1] * screenScale, handleIndex, oppositeHandleIndex, controlIndex);
+                const inkMoveEnd = ptFromScreen({ X: delta[0], Y: delta[1] });
+                const inkMoveStart = ptFromScreen({ X: 0, Y: 0 });
+                InkStrokeProperties.Instance.moveTangentHandle(this.props.inkView, -(inkMoveEnd.X - inkMoveStart.X), -(inkMoveEnd.Y - inkMoveStart.Y), handleIndex, oppositeHandleIndex, controlIndex);
                 return false;
             }, () => {
                 controlUndo?.end();
-- 
cgit v1.2.3-70-g09d2

