Reaching the edges of a diamond

When you are drawing on a canvas, either for a Whiteboard project or a canvas that you have attached to card on a Task Board or Scrum Board, Kerika gives you some basic shapes you can use to sketch out your workflow, process diagrams and other ideas:

Drawing shapes on canvas
Drawing shapes on canvas

You can connect shapes using lines and arrows (single- and double-headed), and as you move the shapes around, the lines and arrows automatically adjust so that they terminate properly on the edge of the shape.

It turns out we had a bug where the lines didn’t properly connect to the very edges of diamond (rhombus) shapes:

Problem with lines on edges of diamonds
Problem with lines on edges of diamonds

This was quite literally an “edge case” (sorry about the pun): when the line travels along the edge of the diamond shape, as the shape is moved by the user, a function is used to calculate the exact intersection of the line and the shape.

(This function is the only proof we have ever seen that anyone actually needs to use trigonometry in real life.)

When the line travels right up to the corner of the diamond shape, because the line is connecting the diamond to another shape that is of precisely the same height and width, and the two shapes are aligned perfectly (either vertically or horizontally), the function returned two possible intersection points.

We have fixed this problem in our latest release. It should make for neater looking flowcharts!