aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/InkStrokeProperties.ts
diff options
context:
space:
mode:
authorvkalev <vjk1883@gmail.com>2021-07-22 11:30:18 -0400
committervkalev <vjk1883@gmail.com>2021-07-22 11:30:18 -0400
commitfabaad0251cf4f64c1af7a37a5f3d6622011c058 (patch)
tree5152eb24ac96d9feefaa0a2223a648d744abd87c /src/client/views/InkStrokeProperties.ts
parent49e99b6d86a503256c2134acb2d8e27ad786e198 (diff)
adding broken indices to layoutDoc working
Diffstat (limited to 'src/client/views/InkStrokeProperties.ts')
-rw-r--r--src/client/views/InkStrokeProperties.ts11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/client/views/InkStrokeProperties.ts b/src/client/views/InkStrokeProperties.ts
index 4c225210e..f218b4fbf 100644
--- a/src/client/views/InkStrokeProperties.ts
+++ b/src/client/views/InkStrokeProperties.ts
@@ -15,7 +15,6 @@ export class InkStrokeProperties {
@observable _lock = false;
@observable _controlButton = false;
@observable _currentPoint = -1;
- // @observable _brokenIndices: List<number> = new List<number>();
constructor() {
InkStrokeProperties.Instance = this;
@@ -112,11 +111,9 @@ export class InkStrokeProperties {
}
}
-
let brokenIndices = Cast(doc.brokenInkIndices, listSpec("number"));
-
// Updating the indices of the control points whose handle tangency has been broken.
- if(brokenIndices){
+ if (brokenIndices) {
brokenIndices = new List(brokenIndices.map((control) => {
if (control >= newIndex) {
return control + 4;
@@ -283,7 +280,7 @@ export class InkStrokeProperties {
}
/**
- * Finds the angle between two inputted vectors.
+ * Finds the angle (in radians) between two inputted vectors.
*
* α = arccos(a·b / |a|·|b|), where a and b are both vectors.
*/
@@ -323,9 +320,9 @@ export class InkStrokeProperties {
const controlPoint = ink[controlIndex];
const newHandlePoint = { X: ink[handleIndex].X - deltaX / xScale, Y: ink[handleIndex].Y - deltaY / yScale };
ink[handleIndex] = newHandlePoint;
- let brokenIndices = Cast(doc.brokenInkIndices, listSpec("number"));
+ const brokenIndices = Cast(doc.brokenInkIndices, listSpec("number"));
// Rotate opposite handle if user hasn't held 'Alt' key or not first/final control (which have only 1 handle).
- if (brokenIndices && !brokenIndices.includes(controlIndex) && handleIndex !== 1 && handleIndex !== ink.length - 2) {
+ if ((!brokenIndices || !brokenIndices?.includes(controlIndex)) && handleIndex !== 1 && handleIndex !== ink.length - 2) {
const angle = this.angleChange(oldHandlePoint, newHandlePoint, controlPoint);
oppositeHandlePoint = this.rotatePoint(oppositeHandlePoint, controlPoint, angle);
ink[oppositeHandleIndex] = oppositeHandlePoint;