fix: #5064 Handle case when line has only one point

This commit is contained in:
Sidharth Vinod
2023-11-24 09:42:21 +05:30
parent f604017f93
commit 78e118c876
2 changed files with 15 additions and 0 deletions

View File

@@ -24,6 +24,9 @@ function calculateDeltaAndAngle(
): { angle: number; deltaX: number; deltaY: number } {
point1 = pointTransformer(point1);
point2 = pointTransformer(point2);
if (point1 === undefined || point2 === undefined) {
return { angle: 0, deltaX: 0, deltaY: 0 };
}
const [x1, y1] = [point1.x, point1.y];
const [x2, y2] = [point2.x, point2.y];
const deltaX = x2 - x1;