aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/InkStrokeProperties.ts
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2021-10-27 00:44:28 -0400
committerbobzel <zzzman@gmail.com>2021-10-27 00:44:28 -0400
commit4aeddc57b8d6654074adaf4cdbf542f1564a9dcc (patch)
treee4713daf90b9b031a04c0ae7c75ff77b2b776bc4 /src/client/views/InkStrokeProperties.ts
parentf8246ab68f43f4e2b43182d2f624b9596382e289 (diff)
more ink drag cleanup - fixed closing curves / dragging with pick correlation
Diffstat (limited to 'src/client/views/InkStrokeProperties.ts')
-rw-r--r--src/client/views/InkStrokeProperties.ts11
1 files changed, 7 insertions, 4 deletions
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 };
}