react-xarrows icon indicating copy to clipboard operation
react-xarrows copied to clipboard

Dividing with 0 if curvness is 0 and absDx

Open coonh opened this issue 3 years ago • 0 comments

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

coonh avatar May 20 '22 08:05 coonh