diff options
author | bobzel <zzzman@gmail.com> | 2024-12-11 13:15:58 -0500 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2024-12-11 13:15:58 -0500 |
commit | f7c7f5f77f1170a84a22eb8b337db7c37a52a5da (patch) | |
tree | 5c8bee9a6ccafa1cdec9d1c9c8f50ca36e7aee88 /src | |
parent | a5a7769e0c400f0a58a9b53ae13b338a26eaa919 (diff) |
reverting changes to inkstroke properties
Diffstat (limited to 'src')
-rw-r--r-- | src/client/views/InkStrokeProperties.ts | 28 |
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'); |