anseki / plain-draggable

The simple and high performance library to allow HTML/SVG element to be dragged.
https://anseki.github.io/plain-draggable/
MIT License
773 stars 99 forks source link

Using the Show and Hide methods related to leaderLine in a plain-Draggable code example #140

Closed aicornes closed 1 year ago

aicornes commented 1 year ago

Hello I have been reviewing the brilliant code and examples you have provided in the leaderLine and plain-draggable repositories but have reached a point where the instructions I have taken and merged from a couple of previous examples are not fully working how I understand the code should written, and I wonder if you are able to help point out what I am doing wrong here..

https://jsfiddle.net/h4k7gzpd/3/

using the suggested array approach to manage groups of leaderLines I can remove() them but the hide() and show() is not functioning in the say way expected, and I am sure you have possible covered this elsewhere, but I have not been able to follow what I am missing here, any assistance would be greatly appreciated, and I assume many other coders would have the same question..

I have added buttons to "Remove" the lines, that works, and to "Hide" or "Show" the lines.. using the array from a previous example, with the draggable "Position()" also is working as expected.. and updating all lines from the node being dragged.

thanks in advance..

anseki commented 1 year ago

Hi @aicornes, thank you for the comment. This may help you: https://jsfiddle.net/rc4h7pqy/ Note that your code has a problem about JavaScript, It is unrelated to PlainDraggable and LeaderLine.

aicornes commented 1 year ago

Appreciate the guidance, I see that the additional options were unnecessary comments.. thankyou.

anseki commented 1 year ago

Yes, your code has unnecessary things. And also, the hideShowAllLeaderLines function being split into two functions (e.g. hideAllLines and showAllLines) may be better. Good luck 😄