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

Can you reopen the issues for leader-line again, because I may need some help #137

Closed aloserman closed 1 year ago

aloserman commented 1 year ago

When I dynamically layout divs, the div components at the previous level will change position or size due to the newly appeared div components. Therefore, the lines that have been drawn before will detach from the div components because they are not redrawn. The div components are generated recursively using Vue. Is there any good solution to this situation?

anseki commented 1 year ago

Hi @aloserman, thank you for the comment. You have to call position method when you changed the layout of the page.

aloserman commented 1 year ago

When the page layout changes, due to the recursive method adopted, the Lines of the parent are not passed to the current page (it should be said that I don't know how to pass it in, because I am not very familiar with Vue development), so I can't call the Line.position method of the parent or the parent's parent? Is there any other way?

anseki commented 1 year ago

The position method is instance method, it is not class method. That is, each instance of LeaderLine has the method. Therefore, you don't have to get the parent or the parent's parent. The example in the document that I indicated may help you.

aloserman commented 1 year ago

That's right. However, I adopted a recursive approach, which means that each level can only obtain the Line instance of the current level, and cannot obtain the parent class, so I cannot call the position method of the parent class Line instance. Maybe I need to obtain all Line instances through provide/inject in Vue, in order to call the position method.

anseki commented 1 year ago

Sorry, I couldn't understand the "level" and "parent class" that you said. Anyway, the position method is instance method, it is not class method. The class is not needed, and you can call an instance method via the instance without the class. For example:

line.position();
anseki commented 1 year ago

No reply came, then this abandoned issue is closed.

calumk commented 1 year ago

Hi @anseki - Just want to ask if there was a specific reason the leader-line repo was archived? Was it a case that the codebase became outdated, or there is a specific reason not to use this library anymore?

Is there a recomended alternative?

anseki commented 1 year ago

Yes, it is outdated. Using another library for drawing lines or helper to handle SVG is better way. However, writing SVG code instead of using the library is best way.