diff --git a/HISTORY.md b/HISTORY.md index 4256caf7..03658203 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -7,6 +7,7 @@ http://visjs.org ### Timeline - Implemented option `minHeight`, similar to option `maxHeight`. +- Added function `repaint()` to force a repaint of the Timeline. - Some tweaks in snapping dragged items to nice dates. - Made the instance of moment.js packaged with vis.js accessibly via `vis.moment`. - Fixed a bug in replacing the DataSet of groups via `Timeline.setGroups(groups)`. diff --git a/docs/timeline.html b/docs/timeline.html index 20df8818..6f6f83eb 100644 --- a/docs/timeline.html +++ b/docs/timeline.html @@ -341,8 +341,7 @@ var options = { autoResize boolean true - If true, the Timeline will automatically detect when its - container is resized, and redraw itself accordingly. + If true, the Timeline will automatically detect when its container is resized, and redraw itself accordingly. If false, the Timeline can be forced to repaint after its container has been resized using the function repaint(). @@ -679,6 +678,13 @@ var options = { Remove an event listener created before via function on(event, callback). See section Events for more information. + + repaint() + none + Force a repaint of the Timeline. Can be useful to manually repaint when option autoResize=false. + + + setGroups(groups) none diff --git a/examples/timeline/16_navigation_menu.html b/examples/timeline/16_navigation_menu.html index f098442b..19ff5d79 100755 --- a/examples/timeline/16_navigation_menu.html +++ b/examples/timeline/16_navigation_menu.html @@ -51,7 +51,7 @@ /** * Move the timeline a given percentage to left or right - * @param {Number} percentage For exampe 0.1 or -0.1 + * @param {Number} percentage For example 0.1 (left) or -0.1 (right) */ function move (percentage) { var range = timeline.getWindow(); @@ -65,7 +65,7 @@ /** * Zoom the timeline a given percentage in or out - * @param {Number} percentage For exampe 0.1 (zoom out) or -0.1 (zoom in) + * @param {Number} percentage For example 0.1 (zoom out) or -0.1 (zoom in) */ function zoom (percentage) { var range = timeline.getWindow(); diff --git a/src/timeline/Timeline.js b/src/timeline/Timeline.js index 477e9732..4d7316c7 100644 --- a/src/timeline/Timeline.js +++ b/src/timeline/Timeline.js @@ -560,6 +560,14 @@ Timeline.prototype.getWindow = function setWindow() { }; }; +/** + * Force a repaint of the Timeline. Can be useful to manually repaint when + * option autoResize=false + */ +Timeline.prototype.repaint = function repaint() { + this.rootPanel.repaint(); +}; + /** * Handle selecting/deselecting an item when tapping it * @param {Event} event