Skip to content

Commit 378a145

Browse files
committed
Dependencies are clone to isolate in case of multiple instances + Fix typescript errors.
1 parent bb01404 commit 378a145

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

arrow.js

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
*
55
* Class to easily draw lines to connect items in the vis Timeline module.
66
*
7-
* @version 4.3.1
8-
* @date 2024-01-16
7+
* @version 4.3.2
8+
* @date 2024-01-17
99
*
1010
* @copyright (c) Javi Domenech (javdome@gmail.com)
1111
*
@@ -85,7 +85,7 @@ export default class Arrow {
8585
"path"
8686
);
8787

88-
this._dependency = dependencies;
88+
this._dependency = [...dependencies];
8989

9090
/** @private @type {SVGPathElement[]} */
9191
this._dependencyPath = [];
@@ -171,16 +171,17 @@ export default class Arrow {
171171

172172
//Checks if at least one item is visible in screen
173173
let oneItemVisible = false; //Iniciamos a false
174+
//Checks if the groups of items are both visible
175+
let groupOf_1_isVisible = false; //Iniciamos a false
176+
let groupOf_2_isVisible = false; //Iniciamos a false
174177
if (bothItemsExist) {
175178
const visibleItems = this._timeline.getVisibleItems();
176179
for (let k = 0; k < visibleItems.length ; k++) {
177180
if (dep.id_item_1 == visibleItems[k]) oneItemVisible = true;
178181
if (dep.id_item_2 == visibleItems[k]) oneItemVisible = true;
179182
}
180183

181-
//Checks if the groups of items are both visible
182-
var groupOf_1_isVisible = false; //Iniciamos a false
183-
var groupOf_2_isVisible = false; //Iniciamos a false
184+
184185

185186
let groupOf_1 = this._timeline.itemsData.get(dep.id_item_1).group; //let groupOf_1 = items.get(dep.id_item_1).group;
186187

@@ -193,10 +194,10 @@ export default class Arrow {
193194

194195
// If groups are null then they are not visible.
195196
if (groupOf_1 == null){
196-
var groupOf_1_isVisible = false;
197+
groupOf_1_isVisible = false;
197198
}
198199
if (groupOf_2 == null){
199-
var groupOf_2_isVisible = false;
200+
groupOf_2_isVisible = false;
200201
}
201202
}
202203

@@ -327,8 +328,9 @@ export default class Arrow {
327328

328329
this._dependency.splice(index, 1); //Elimino del array dependency
329330
this._dependencyPath.splice(index, 1); //Elimino del array dependencyPath
330-
331-
list[index + 1].parentNode.removeChild(list[index + 1]); //Lo elimino del dom
331+
332+
list[index + 1].parentNode?.removeChild(list[index + 1]); //Lo elimino del dom
333+
332334
}
333335
}
334336

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "timeline-arrows",
3-
"version": "4.3.1",
3+
"version": "4.3.2",
44
"description": "Package to easily draw lines to connect items in the vis Timeline module.",
55
"main": "arrow.js",
66
"types": "arrow.d.ts",

0 commit comments

Comments
 (0)