Leader Line Inside Scrolling Div

See original GitHub issue

First of all, this library is pretty amazing. Really good work! Well documented and the arrows/lines are highly customizable. Im developing an online editor with ‘nodes’, which are connected with ‘leader-lines’ and this library helped me a lot.

Im just facing a problem, I wasn’t able to solve myself. The body has 100% width and height and I have a bigger inner div which is the “editor area”. It is scrollable (and later dragable) so the user can navigate though it. The arrows are connecting different divs (nodes) the user can create and drag around. For repositioning I use the .position() function. At the moment I just reposition all arrows if I detect a scroll on my inner div but this is pretty inefficient and it’s getting jerky.

So I tried to move the arrows to my editor div, like you mentioned in Issue #159 document.getElementById('container').appendChild(document.querySelector('.leader-line')); The arrows scrolls with the div, thats good but now the positions are not calculated correctly. It would be pretty awesome if this library can support appending the leader-lines to another div so they move with them without the need of new calculations (scrolling divs…dragable elements etc.) I think this might be a nice and usefull feature. If this feature is to complex in general, I would be glad if you can help me finding a way to solve the position calculation problem in my case.

Its a web application based on angular but I made a minimalistic pure html/css/js example for you. Just scroll in the div and an click the reposition button https://jsfiddle.net/2um5caLn/52/

Best regards, Christian

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ansekicommented, Sep 17, 2020

Hi @christian-iron60, thank you for the comment. This may help you: https://jsfiddle.net/2sfxvy8k/

0reactions
ansekicommented, Sep 21, 2020

Thank you for the information. 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

Add lines to particular div instead of window itself #54 - GitHub
The content inside tab will be scrollable, so while scrolling the lines are shown above tab headers & menu as it's drawn on...
Read more >
SVG Line outside parent div - javascript - Stack Overflow
I need the line to remain inside the DIV, I'm using "leader-line.min.js" to draw the lines, <form id="form1" runat="server"> <script ...
Read more >
LeaderLine #scroll - CodePen
Adding Classes. In CodePen, whatever you write in the HTML editor is what goes within the <body> tags in a basic HTML5 template....
Read more >
LeaderLine - GitHub Pages
Draw a leader line in your web page. ... Scroll this. Move mouse here. Basically, it can indicate HTML/SVG element such as <div>...
Read more >
create a flexible leader line in div after a label field
create a flexible leader line in div after a label field ... .line-wrapper { display: block; overflow: hidden; padding-top: 6px; } .hzline {...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found