javdome / timeline-arrows

Class to easily draw lines to connect items in the vis Timeline module. See examples here: https://javdome.github.io/timeline-arrows/index.html
MIT License
42 stars 10 forks source link

Add followRelationships configuration option #4

Closed paulinemss closed 2 years ago

paulinemss commented 2 years ago

Hi,

Great lib! Very useful when working with vis-timeline.

This change adds a configuration option to allow arrows to point backwards if needed, instead of the default behavior which is to follow the timeline's left-to-right direction.

Closes #3

javdome commented 2 years ago

Thanks Pauline!! This is my first PR!!... I am reviewing the code, and I see that many times appears a double arrow: CapturaTimeline

I propose to add the followings to fix this problem: First when you add the marker-start: this._dependencyPath[index].setAttribute("marker-start", "url(#arrowhead0)"); Then you should "remove" the marker-end: this._dependencyPath[index].setAttribute("marker-end", "");

And viceversa: Under de line: this._dependencyPath[index].setAttribute("marker-end", "url(#arrowhead0)") Add this._dependencyPath[index].setAttribute("marker-start", "");

What do you think??

(Sorry for my "way" of reviewing PR... I have never done this before)

paulinemss commented 2 years ago

Thank you for reviewing and accepting my PR! Yes, that makes a lot of sense. I had considered "backwards" arrows but not 2-way 😄 Saw you fixed it already, that's awesome - thanks again for the great lib!