From cd30aa9f139437c9e01a121b274c4d0edade171c Mon Sep 17 00:00:00 2001 From: yotamberk Date: Thu, 16 Feb 2017 17:44:18 +0200 Subject: [PATCH] feat(timeline): #2647 Dynamic rolling mode option (#2705) * Fix redraw order * Fix error when option is not defined * Allow template labels * Add .travis.yml file * Add experiment travis code * Fix react example * Add toggleRollingMode option * Update docs with toggleRollingMode option --- docs/timeline/index.html | 7 +++++++ .../timeline/interaction/navigationMenu.html | 3 +++ lib/timeline/Timeline.js | 16 ++++++++++++++++ 3 files changed, 26 insertions(+) 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;