Use atan2
This commit is contained in:
parent
001df5bade
commit
b2b6d69477
@ -298,9 +298,9 @@ export class LinearElementEditor {
|
||||
element.points[selectedIndex === 0 ? 1 : selectedIndex - 1];
|
||||
customLineAngle =
|
||||
linearElementEditor.customLineAngle ??
|
||||
Math.atan(
|
||||
(element.points[selectedIndex][1] - referencePoint[1]) /
|
||||
(element.points[selectedIndex][0] - referencePoint[0]),
|
||||
Math.atan2(
|
||||
element.points[selectedIndex][1] - referencePoint[1],
|
||||
element.points[selectedIndex][0] - referencePoint[0],
|
||||
);
|
||||
|
||||
const [width, height] = LinearElementEditor._getShiftLockedDelta(
|
||||
|
@ -145,7 +145,7 @@ export const getLockedLinearCursorAlignSize = (
|
||||
let width = x - originX;
|
||||
let height = y - originY;
|
||||
|
||||
const angle = Math.atan(height / width) as Radians;
|
||||
const angle = Math.atan2(height, width) as Radians;
|
||||
let lockedAngle = (Math.round(angle / SHIFT_LOCKING_ANGLE) *
|
||||
SHIFT_LOCKING_ANGLE) as Radians;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user