aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/InkStrokeProperties.ts
diff options
context:
space:
mode:
authorJoanne <zehan_ding@brown.edu>2025-06-20 10:18:38 -0400
committerJoanne <zehan_ding@brown.edu>2025-06-20 10:18:38 -0400
commit61787b3c1cf53c0230f6142bee0df30c65971012 (patch)
tree36c43ca031722b9a92f3f344288c8f6cf7fff5e1 /src/client/views/InkStrokeProperties.ts
parent2aa2c26b95a539d220e46b20cdfbef6ae39d6c43 (diff)
parente7a96fa043cfc9c3c426e09bbef42c8df88a45f6 (diff)
Merge branch 'master' of https://github.com/brown-dash/Dash-Web into joanne-tutorialagent
Diffstat (limited to 'src/client/views/InkStrokeProperties.ts')
-rw-r--r--src/client/views/InkStrokeProperties.ts23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/client/views/InkStrokeProperties.ts b/src/client/views/InkStrokeProperties.ts
index 41f38c008..9f2c1fc4e 100644
--- a/src/client/views/InkStrokeProperties.ts
+++ b/src/client/views/InkStrokeProperties.ts
@@ -209,17 +209,18 @@ export class InkStrokeProperties {
* @param scrpt The center point of the rotation in screen coordinates
*/
rotateInk = undoable((inkStrokes: DocumentView[], angle: number, scrpt: PointData) => {
- this.applyFunction(inkStrokes, (view: DocumentView, ink: InkData, xScale: number, yScale: number /* , inkStrokeWidth: number */) => {
- const inkCenterPt = view.ComponentView?.ptFromScreen?.(scrpt);
- return !inkCenterPt
- ? ink
- : ink.map(i => {
- const pt = { X: i.X - inkCenterPt.X, Y: i.Y - inkCenterPt.Y };
- const newX = Math.cos(angle) * pt.X - (Math.sin(angle) * pt.Y * yScale) / xScale;
- const newY = (Math.sin(angle) * pt.X * xScale) / yScale + Math.cos(angle) * pt.Y;
- return { X: newX + inkCenterPt.X, Y: newY + inkCenterPt.Y };
- });
- });
+ angle &&
+ this.applyFunction(inkStrokes, (view: DocumentView, ink: InkData, xScale: number, yScale: number /* , inkStrokeWidth: number */) => {
+ const inkCenterPt = view.ComponentView?.ptFromScreen?.(scrpt);
+ return !inkCenterPt
+ ? ink
+ : ink.map(i => {
+ const pt = { X: i.X - inkCenterPt.X, Y: i.Y - inkCenterPt.Y };
+ const newX = Math.cos(angle) * pt.X - (Math.sin(angle) * pt.Y * yScale) / xScale;
+ const newY = (Math.sin(angle) * pt.X * xScale) / yScale + Math.cos(angle) * pt.Y;
+ return { X: newX + inkCenterPt.X, Y: newY + inkCenterPt.Y };
+ });
+ });
}, 'rotate ink');
/**