Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>To draw a line between those boxes, you'd first have to define where you want the line to be.</p> <p><img src="https://i.stack.imgur.com/PPumi.png" alt="two boxes"></p> <p>Apparently you want to draw the lines/arrows from the right edge of Rect A to the left edge of Rect B, somewhat like this:</p> <p><img src="https://i.stack.imgur.com/6V9DP.png" alt="two boxes with a link"></p> <p>Assuming your know the origin (upper left <code>Point</code> as { x, y } of a <code>Rect</code>) and its <code>Size</code> (width and height), you first want to determine the position of the center of the edges:</p> <p><img src="https://i.stack.imgur.com/QApmW.png" alt="center of edges highlighted"></p> <pre><code>var rectA, rectB; // I assume you have those data var rectARightEdgeCenter = { // x is simply the origin's x plus the width x: rectA.origin.x + rectA.size.width, // for y you need to add only half the height to origin.y y: rectA.origin.y + rectA.size.height / 2.0 } var rectBLeftEdgeCenter = { // x will be simply the origin's x x: rectB.origin.x, // y is half the height added to the origin's y, just as before y: rectB.origin.y + rectB.size.height / 2.0 } </code></pre> <p>The more interesting question would be how to determine, from which edge to which other edge you might want to draw the lines in a more dynamic scenario.</p> <p>If your boxes just pile up from left to right the given solution will fit, but you might want to check for minimum distances of the edges, to determine a possible <em>best</em> arrow.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload