diff --git a/docs/timeline/index.html b/docs/timeline/index.html index edc0f56f..7ec093ae 100644 --- a/docs/timeline/index.html +++ b/docs/timeline/index.html @@ -1431,6 +1431,13 @@ document.getElementById('myTimeline').onclick = function (event) { + + toggleRollingMode() + none + Toggle rollingMode. + + + zoomIn(percentage) none diff --git a/examples/timeline/interaction/navigationMenu.html b/examples/timeline/interaction/navigationMenu.html index 75a04fdb..9f2dcd68 100755 --- a/examples/timeline/interaction/navigationMenu.html +++ b/examples/timeline/interaction/navigationMenu.html @@ -38,6 +38,7 @@ + @@ -74,6 +75,8 @@ document.getElementById('zoomOut').onclick = function () { timeline.zoomOut( 0.2); }; document.getElementById('moveLeft').onclick = function () { move( 0.2); }; document.getElementById('moveRight').onclick = function () { move(-0.2); }; + document.getElementById('toggleRollingMode').onclick = function () { timeline.toggleRollingMode() }; + diff --git a/lib/timeline/Timeline.js b/lib/timeline/Timeline.js index e27359e3..301beadb 100644 --- a/lib/timeline/Timeline.js +++ b/lib/timeline/Timeline.js @@ -572,4 +572,20 @@ Timeline.prototype.getEventProperties = function (event) { } }; +/** + * Toggle Timeline rolling mode + */ + +Timeline.prototype.toggleRollingMode = function () { + if (this.range.rolling) { + this.range.stopRolling(); + } else { + if (this.options.rollingMode == undefined) { + this.setOptions(options) + } + this.range.startRolling(); + } + +} + module.exports = Timeline;