diff --git a/HISTORY.md b/HISTORY.md index 9a28ac26..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 @@ -24,6 +25,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 +36,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/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); 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 90f14504..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 @@ -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}); }; /**