From 717f1f148b9f2a161993c9744de3413b8588fe32 Mon Sep 17 00:00:00 2001 From: jos Date: Tue, 26 Jan 2016 09:29:48 +0100 Subject: [PATCH 1/3] Moved `emit('_change'...)` from Timeline.setItems to ItemSet.setItems to be consistend with ItemSet.setGroups --- lib/timeline/Timeline.js | 3 --- lib/timeline/component/ItemSet.js | 2 ++ 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/timeline/Timeline.js b/lib/timeline/Timeline.js index 90f14504..c5c76cba 100644 --- a/lib/timeline/Timeline.js +++ b/lib/timeline/Timeline.js @@ -237,9 +237,6 @@ Timeline.prototype.setItems = function(items) { // set items this.itemsData = newDataSet; this.itemSet && this.itemSet.setItems(newDataSet); - - this.body.emitter.emit('_change', {queue: true}); - }; /** diff --git a/lib/timeline/component/ItemSet.js b/lib/timeline/component/ItemSet.js index d6b283ee..d66c77e4 100644 --- a/lib/timeline/component/ItemSet.js +++ b/lib/timeline/component/ItemSet.js @@ -726,6 +726,8 @@ ItemSet.prototype.setItems = function(items) { // update the group holding all ungrouped items this._updateUngrouped(); } + + this.body.emitter.emit('_change', {queue: true}); }; /** From f171328c10dd56f281b8c7e699bc56b968da6c7e Mon Sep 17 00:00:00 2001 From: jos Date: Tue, 26 Jan 2016 09:33:08 +0100 Subject: [PATCH 2/3] Fixed #1541: Timeline and Graph2d did not load synchronously anymore --- HISTORY.md | 2 ++ lib/timeline/Graph2d.js | 2 ++ lib/timeline/Timeline.js | 6 +++--- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index 9a28ac26..11447f1c 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -24,6 +24,7 @@ http://visjs.org - Fixed #1580: Invisible timeline/graph should not be drawn, as most inputs are invalid - Fixed #1521: Prevent items from staying stuck to the left side of the viewport. - Fixed #1592: Emit a "changed" event after each redraw. +- Fixed #1541: Timeline and Graph2d did not load synchronously anymore. ### Graph2d @@ -34,6 +35,7 @@ http://visjs.org - Cleanup of linegraph's event handling. - Fixed #1017: Fixed minWidth behavior for bars. - Fixes #1557: Fix default axis formatting function. +- Fixed #1541: Timeline and Graph2d did not load synchronously anymore. ## 2016-01-08, version 4.12.0 diff --git a/lib/timeline/Graph2d.js b/lib/timeline/Graph2d.js index 9bca8f61..a5498eb5 100644 --- a/lib/timeline/Graph2d.js +++ b/lib/timeline/Graph2d.js @@ -124,6 +124,8 @@ function Graph2d (container, items, groups, options) { if (items) { this.setItems(items); } + + // draw for the first time this._redraw(); } diff --git a/lib/timeline/Timeline.js b/lib/timeline/Timeline.js index c5c76cba..e2bfd555 100644 --- a/lib/timeline/Timeline.js +++ b/lib/timeline/Timeline.js @@ -157,9 +157,9 @@ function Timeline (container, items, groups, options) { if (items) { this.setItems(items); } - else { - this._redraw(); - } + + // draw for the first time + this._redraw(); } // Extend the functionality from Core From 81510b63ddfcf300e34d69a2d44f15101e262cec Mon Sep 17 00:00:00 2001 From: Felix Hayashi Date: Wed, 27 Jan 2016 17:31:40 +0100 Subject: [PATCH 3/3] Fixed wrong variable reference see #1608 --- HISTORY.md | 1 + lib/network/modules/components/edges/util/EdgeBase.js | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index 11447f1c..355fbf1c 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -17,6 +17,7 @@ http://visjs.org - Fixed #1596: correct clean up of manipulation dom elements. - Fixed #1594: bug in hierarchical layout. - Fixed #1597: Allow zero borders and addressed scaling artifacts. +- Fixed #1608: Fixed wrong variable reference ### Timeline diff --git a/lib/network/modules/components/edges/util/EdgeBase.js b/lib/network/modules/components/edges/util/EdgeBase.js index 2ae06715..659313a1 100644 --- a/lib/network/modules/components/edges/util/EdgeBase.js +++ b/lib/network/modules/components/edges/util/EdgeBase.js @@ -457,11 +457,11 @@ class EdgeBase { if (position === 'from') { arrowPoint = this.findBorderPosition(this.from, ctx, {x, y, low:0.25, high:0.6, direction:-1}); - angle = point.t * -2 * Math.PI + 1.5 * Math.PI + 0.1 * Math.PI; + angle = arrowPoint.t * -2 * Math.PI + 1.5 * Math.PI + 0.1 * Math.PI; } else if (position === 'to') { arrowPoint = this.findBorderPosition(this.from, ctx, {x, y, low:0.6, high:1.0, direction:1}); - angle = point.t * -2 * Math.PI + 1.5 * Math.PI - 1.1 * Math.PI; + angle = arrowPoint.t * -2 * Math.PI + 1.5 * Math.PI - 1.1 * Math.PI; } else { arrowPoint = this._pointOnCircle(x, y, radius, 0.175);