From 4aeddc57b8d6654074adaf4cdbf542f1564a9dcc Mon Sep 17 00:00:00 2001 From: bobzel Date: Wed, 27 Oct 2021 00:44:28 -0400 Subject: more ink drag cleanup - fixed closing curves / dragging with pick correlation --- src/client/views/InkStrokeProperties.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/client/views/InkStrokeProperties.ts') diff --git a/src/client/views/InkStrokeProperties.ts b/src/client/views/InkStrokeProperties.ts index a0fdfcd7f..7c91a3323 100644 --- a/src/client/views/InkStrokeProperties.ts +++ b/src/client/views/InkStrokeProperties.ts @@ -199,7 +199,7 @@ export class InkStrokeProperties { (order === 3 && controlIndex !== ink.length - 1 && i === controlIndex + 1) || (order === 3 && controlIndex !== ink.length - 1 && i === controlIndex + 2) || ((ink[0].X === ink[ink.length - 1].X) && (ink[0].Y === ink[ink.length - 1].Y) && (i === 0 || i === ink.length - 1) && (controlIndex === 0 || controlIndex === ink.length - 1))) { - return ({ X: pt.X + deltaX / xScale, Y: pt.Y + deltaY / yScale }); + return ({ X: pt.X + deltaX, Y: pt.Y + deltaY }); } return pt; }); @@ -243,7 +243,9 @@ export class InkStrokeProperties { if (snapData.distance < 10) { const deltaX = (snapData.nearestPt.X - ink[controlIndex].X); const deltaY = (snapData.nearestPt.Y - ink[controlIndex].Y); - return this.moveControlPtHandle(inkView, deltaX, deltaY, controlIndex); + const res = this.moveControlPtHandle(inkView, deltaX, deltaY, controlIndex); + console.log("X= " + snapData.nearestPt.X + " " + snapData.nearestPt.Y); + return res; } } } @@ -269,8 +271,9 @@ export class InkStrokeProperties { const testInkView = DocumentManager.Instance.getDocumentView(doc, containingCollection?.props.CollectionView); const snapped = testInkView?.ComponentView?.snapPt?.(screenDragPt, doc === inkView.rootDoc ? this.excludeSelfSnapSegs(ink, controlIndex) : []); if (snapped && snapped.distance < snapData.distance) { - const snappedScrPt = testInkView?.ComponentView?.ptToScreen?.(snapped.nearestPt); // convert from snapped ink coordinate system to dragged ink coordinate system by converting to/from screen space - const snappedInkPt = snappedScrPt && inkView.ComponentView?.ptFromScreen?.(snappedScrPt); + const snappedInkPt = doc === inkView.rootDoc ? snapped.nearestPt : + inkView.ComponentView?.ptFromScreen?.(testInkView?.ComponentView?.ptToScreen?.(snapped.nearestPt) ?? { X: 0, Y: 0 }); // convert from snapped ink coordinate system to dragged ink coordinate system by converting to/from screen space + if (snappedInkPt) { snapData = { nearestPt: snappedInkPt, distance: snapped.distance }; } -- cgit v1.2.3-70-g09d2