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

Is it possible to draw arrows between divs? #32

Open
urcades opened this issue Jun 16, 2016 · 1 comment
Open

Is it possible to draw arrows between divs? #32

urcades opened this issue Jun 16, 2016 · 1 comment

Comments

@urcades
Copy link

urcades commented Jun 16, 2016

Hi!

I scanned through the documentation super quickly, and while I understood that in true canvas sense, drawing from coordinate to coordinate was possible, I wanted to ask if it's possible to draw lines between various DOM nodes.

I'm thinking like:

<div id="A">I want to draw a line from this</div> 
<div id="B">to this</div> 
svg.append("path")
  .attr('marker-end', 'url(#arrowhead)')
  .datum([[#A],[#B]])
  .attr("d", swoopy);

Obviously this is really shitty shorthand, but I'm curious if this is possible, or could be made to be possible.

Thanks!

@1wheel
Copy link

1wheel commented Jun 16, 2016

Definitely possible - you'd want to look up the position of the two divs, translate their corners to the svg coordinate space, then pass those positions to swoopy.

I think @tophtucker did something similar here:

www.bloomberg.com/features/2016-how-did-i-get-here/gert-boyle.html

http://www.bloomberg.com/features/2016-how-did-i-get-here/js/arrowConnector.js

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

2 participants