44 *
55 * Class to easily draw lines to connect items in the vis Timeline module.
66 *
7- * @version 4.1 .1
8- * @date 2023-11-07
7+ * @version 4.3 .1
8+ * @date 2024-01-16
99 *
1010 * @copyright (c) Javi Domenech (javdome@gmail.com)
1111 *
@@ -90,6 +90,9 @@ export default class Arrow {
9090 /** @private @type {SVGPathElement[] } */
9191 this . _dependencyPath = [ ] ;
9292
93+ /** @private @type {string } */
94+ this . _arrowHeadId = `arrowhead-${ Math . random ( ) . toString ( 36 ) . substring ( 2 ) } ` ;
95+
9396 this . _initialize ( ) ;
9497 }
9598
@@ -105,7 +108,7 @@ export default class Arrow {
105108 this . _timeline . dom . center . appendChild ( this . _svg ) ;
106109
107110 //Configure the arrowHead
108- this . _arrowHead . setAttribute ( "id" , "arrowhead0" ) ;
111+ this . _arrowHead . setAttribute ( "id" , this . _arrowHeadId ) ;
109112 this . _arrowHead . setAttribute ( "viewBox" , "-10 -5 10 10" ) ;
110113 this . _arrowHead . setAttribute ( "refX" , "-7" ) ;
111114 this . _arrowHead . setAttribute ( "refY" , "0" ) ;
@@ -209,7 +212,7 @@ export default class Arrow {
209212
210213 if ( this . _followRelationships && item_2 . mid_x < item_1 . mid_x ) {
211214 item_2 . right += 10 ; // Space for the arrowhead.
212- this . _dependencyPath [ index ] . setAttribute ( "marker-start" , " url(#arrowhead0)" ) ;
215+ this . _dependencyPath [ index ] . setAttribute ( "marker-start" , ` url(#${ this . _arrowHeadId } )` ) ;
213216 this . _dependencyPath [ index ] . setAttribute ( "marker-end" , "" ) ;
214217 this . _dependencyPath [ index ] . setAttribute (
215218 "d" ,
@@ -232,7 +235,7 @@ export default class Arrow {
232235 ) ;
233236 } else {
234237 item_2 . left -= 10 ; // Space for the arrowhead.
235- this . _dependencyPath [ index ] . setAttribute ( "marker-end" , " url(#arrowhead0)" ) ;
238+ this . _dependencyPath [ index ] . setAttribute ( "marker-end" , ` url(#${ this . _arrowHeadId } )` ) ;
236239 this . _dependencyPath [ index ] . setAttribute ( "marker-start" , "" ) ;
237240 this . _dependencyPath [ index ] . setAttribute (
238241 "d" ,
0 commit comments