aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/InkStrokeProperties.ts
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2025-04-23 22:02:51 -0400
committerbobzel <zzzman@gmail.com>2025-04-23 22:02:51 -0400
commit0e6d7b45c14301d426f85eeef0a96ab8dceebc25 (patch)
tree5eb67dd31b631189caf6ceb1192088c8e934349a /src/client/views/InkStrokeProperties.ts
parentdb2029602586985b7113fa436851b19746eac673 (diff)
parent78ac87b8acf63079071e5e8805692ed8c30042ce (diff)
Merge branch 'master' into aarav_edit
Diffstat (limited to 'src/client/views/InkStrokeProperties.ts')
-rw-r--r--src/client/views/InkStrokeProperties.ts8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/client/views/InkStrokeProperties.ts b/src/client/views/InkStrokeProperties.ts
index 425f5b6bb..41f38c008 100644
--- a/src/client/views/InkStrokeProperties.ts
+++ b/src/client/views/InkStrokeProperties.ts
@@ -99,7 +99,7 @@ export class InkStrokeProperties {
controls.splice(i, 4, ...splicepts.map(p => ({ X: p.x, Y: p.y })));
// Updating the indices of the control points whose handle tangency has been broken.
- doc.brokenInkIndices = new List(Cast(doc.brokenInkIndices, listSpec('number'), []).map(control => (control > i ? control + 4 : control)));
+ doc.brokenInkIndices = new List(NumListCast(doc.brokenInkIndices).map(control => (control > i ? control + 4 : control)));
runInAction(() => {
this._currentPoint = -1;
});
@@ -252,7 +252,7 @@ export class InkStrokeProperties {
this.applyFunction(inkView, (view: DocumentView, ink: InkData) => {
const order = controlIndex % 4;
const closed = InkingStroke.IsClosed(ink);
- const brokenIndices = Cast(inkView.Document.brokenInkIndices, listSpec('number'), []);
+ const brokenIndices = NumListCast(inkView.Document.brokenInkIndices);
if (origInk && this._currentPoint > 0 && this._currentPoint < ink.length - 1 && brokenIndices.findIndex(value => value === controlIndex) === -1) {
const cptBefore = ink[controlIndex];
const cpt = { X: cptBefore.X + deltaX, Y: cptBefore.Y + deltaY };
@@ -405,9 +405,9 @@ export class InkStrokeProperties {
this.applyFunction(inkView, (view: DocumentView, ink: InkData) => {
const doc = view.Document;
const brokenIndices = Cast(doc.brokenInkIndices, listSpec('number'), []);
- const ind = brokenIndices.findIndex(value => value === controlIndex);
+ const ind = brokenIndices?.findIndex(value => value === controlIndex) ?? -1;
if (ind !== -1) {
- brokenIndices.splice(ind, 1);
+ brokenIndices!.splice(ind, 1);
const [controlPoint, handleA, handleB] = [ink[controlIndex], ink[handleIndexA], ink[handleIndexB]];
const oppositeHandleA = this.rotatePoint(handleA, controlPoint, Math.PI);
const angleDifference = InkStrokeProperties.angleChange(handleB, oppositeHandleA, controlPoint);