aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/InkStrokeProperties.ts
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2023-04-05 22:44:03 -0400
committerbobzel <zzzman@gmail.com>2023-04-05 22:44:03 -0400
commit9b41da1af16b982ee8ac2fc09f2f8b5d67eac9fb (patch)
treebc3f57cd5b31fd453d272c925f6d5b728ab63bae /src/client/views/InkStrokeProperties.ts
parent9dae453967183b294bf4f7444b948023a1d52d39 (diff)
parent8f7e99641f84ad15f34ba9e4a60b664ac93d2e5d (diff)
Merge branch 'master' into data-visualization-view-naafi
Diffstat (limited to 'src/client/views/InkStrokeProperties.ts')
-rw-r--r--src/client/views/InkStrokeProperties.ts13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/client/views/InkStrokeProperties.ts b/src/client/views/InkStrokeProperties.ts
index 821e2f739..e6df0801c 100644
--- a/src/client/views/InkStrokeProperties.ts
+++ b/src/client/views/InkStrokeProperties.ts
@@ -19,7 +19,6 @@ export class InkStrokeProperties {
return this._Instance || new InkStrokeProperties();
}
- @observable _lock = false;
@observable _controlButton = false;
@observable _currentPoint = -1;
@@ -342,13 +341,19 @@ export class InkStrokeProperties {
if (ink) {
const screenDragPt = inkView.ComponentView?.ptToScreen?.(ink[controlIndex]);
if (screenDragPt) {
+ if (controlIndex === ink.length - 1) {
+ const firstPtScr = inkView.ComponentView?.ptToScreen?.(ink[0]);
+ if (firstPtScr && Math.sqrt((firstPtScr.X - screenDragPt.X) * (firstPtScr.X - screenDragPt.X) + (firstPtScr.Y - screenDragPt.Y) * (firstPtScr.Y - screenDragPt.Y)) < 7) {
+ const deltaX = ink[0].X - ink[controlIndex].X;
+ const deltaY = ink[0].Y - ink[controlIndex].Y;
+ return this.moveControlPtHandle(inkView, deltaX, deltaY, controlIndex, ink.slice());
+ }
+ }
const snapData = this.snapToAllCurves(screenDragPt, inkView, { nearestPt: { X: 0, Y: 0 }, distance: 10 }, ink, controlIndex);
if (snapData.distance < 10) {
const deltaX = snapData.nearestPt.X - ink[controlIndex].X;
const deltaY = snapData.nearestPt.Y - ink[controlIndex].Y;
- const res = this.moveControlPtHandle(inkView, deltaX, deltaY, controlIndex, ink.slice());
- console.log('X = ' + snapData.nearestPt.X + ' ' + snapData.nearestPt.Y);
- return res;
+ return this.moveControlPtHandle(inkView, deltaX, deltaY, controlIndex, ink.slice());
}
}
}