aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client/views/InkStrokeProperties.ts28
1 files changed, 3 insertions, 25 deletions
diff --git a/src/client/views/InkStrokeProperties.ts b/src/client/views/InkStrokeProperties.ts
index 8165b7f4e..358274f0e 100644
--- a/src/client/views/InkStrokeProperties.ts
+++ b/src/client/views/InkStrokeProperties.ts
@@ -74,7 +74,6 @@ export class InkStrokeProperties {
doc._height = (newYrange.max - newYrange.min) * ptsYscale + NumCast(doc.stroke_width);
doc.x = oldXrange.coord + (newXrange.min - oldXrange.min) * ptsXscale;
doc.y = oldYrange.coord + (newYrange.min - oldYrange.min) * ptsYscale;
-
Doc.SetInPlace(doc, 'stroke', new InkField(newPoints), true);
appliedFunc = true;
}
@@ -249,7 +248,7 @@ export class InkStrokeProperties {
/**
* Handles the movement/scaling of a control point.
*/
- moveControlPtHandle = undoable((inkView: DocumentView, deltaX: number, deltaY: number, controlIndex: number, origInk?: InkData, noPush?: boolean) => {
+ moveControlPtHandle = undoable((inkView: DocumentView, deltaX: number, deltaY: number, controlIndex: number, origInk?: InkData) => {
inkView &&
this.applyFunction(inkView, (view: DocumentView, ink: InkData) => {
const order = controlIndex % 4;
@@ -289,11 +288,10 @@ export class InkStrokeProperties {
const { finalCtrls: rightCtrls /* , error: errorRight */ } = FitOneCurve(samplesRight, { X: startDir.x, Y: startDir.y }, { X: endDir.x, Y: endDir.y });
finalCtrls = finalCtrls.concat(rightCtrls);
newink.splice(this._currentPoint - 4, 8, ...finalCtrls);
+ return newink;
}
- const prevData = (inkView.ComponentView as InkingStroke).screenCtrlPts;
-
- const newInk = ink.map((pt, i) => {
+ return ink.map((pt, i) => {
const leftHandlePoint = order === 0 && i === controlIndex + 1;
const rightHandlePoint = order === 0 && controlIndex !== 0 && i === controlIndex - 2;
if (controlIndex === i || (order === 0 && controlIndex !== 0 && i === controlIndex - 1) || (order === 3 && i === controlIndex - 1)) {
@@ -314,26 +312,6 @@ export class InkStrokeProperties {
}
return pt;
});
-
- if (inkView.IsSelected && !noPush && !InkingStroke.IsClosed(prevData)) {
- const ffview = CollectionFreeFormView.from(inkView);
- ffview?.childDocs.forEach(d => {
- const oinkDoc = DocumentView.getDocumentView(d);
- const oinkView = oinkDoc?.ComponentView as InkingStroke;
- if (oinkView instanceof InkingStroke && oinkDoc && oinkDoc.Document !== inkView.Document) {
- const { nearestSeg, nearestT } = InkStrokeProperties.nearestPtToStroke(oinkView.screenCtrlPts, prevData[controlIndex]);
- const locdelta = inkView.screenToContentsTransform().inverse().transformDirection(deltaX, deltaY);
- const index = nearestSeg + Math.round(nearestT) * 4;
- const oinkData = oinkView.inkScaledData().inkData;
- const closed = InkingStroke.IsClosed(oinkData);
- InkStrokeProperties.Instance.moveControlPtHandle(oinkDoc, locdelta[0], locdelta[1], index, undefined, true);
- if (index === oinkData.length && closed) {
- InkStrokeProperties.Instance.moveControlPtHandle(oinkDoc, locdelta[0], locdelta[1], 0, undefined, true);
- }
- }
- });
- }
- return newInk;
});
}, 'move ink ctrl pt');