Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dividing with 0 if curvness is 0 and absDx #139

Open
coonh opened this issue May 20, 2022 · 0 comments
Open

Dividing with 0 if curvness is 0 and absDx #139

coonh opened this issue May 20, 2022 · 0 comments

Comments

@coonh
Copy link

coonh commented May 20, 2022

Describe the bug & Expected behavior
If there is a straight arrow with curvness 0 and the x-coordinates of start and end point are identical, there is an NaN excpetion.
I already fixed it. It occurs in the GetPosition.tsx File line 107. YOu are dividing with 0 because absDx is 0 in that case.
I wrote:

let headAngel = absDx===0 ? Math.atan(absDy) : Math.atan(absDy / absDx);

I tested it with ur Example and it seams to work just fine and the Head Angle seams to be calculated correctly.

To Reproduce
In your Example FewArrows I set the curvness of the blue Arrow to 0, so it is straight and overlayed box2 and box1

Screenshots
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant