diff --git a/HISTORY.md b/HISTORY.md index 786e299e..cffe8437 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -6,6 +6,7 @@ http://visjs.org ### Timeline +- Implemented `currentTimeTick` event (see #1683). - Fixed #1630: method `getItemRange` missing in docs. ### Graph2d diff --git a/docs/graph2d/index.html b/docs/graph2d/index.html index e6412f7b..ed062202 100644 --- a/docs/graph2d/index.html +++ b/docs/graph2d/index.html @@ -1304,6 +1304,12 @@ Graph2d.off('rangechanged', onChange); Properties Description + + + currentTimeTick + Fired when the current time bar redraws. The rate depends on the zoom level. + + click diff --git a/docs/timeline/index.html b/docs/timeline/index.html index 9d41a32b..f0b4d742 100644 --- a/docs/timeline/index.html +++ b/docs/timeline/index.html @@ -1348,6 +1348,11 @@ timeline.off('select', onSelect); Description + + currentTimeTick + Fired when the current time bar redraws. The rate depends on the zoom level. + + click diff --git a/lib/timeline/component/CurrentTime.js b/lib/timeline/component/CurrentTime.js index d23ba377..ee1c7148 100644 --- a/lib/timeline/component/CurrentTime.js +++ b/lib/timeline/component/CurrentTime.js @@ -129,6 +129,7 @@ CurrentTime.prototype.start = function() { if (interval > 1000) interval = 1000; me.redraw(); + me.body.emitter.emit('currentTimeTick'); // start a renderTimer to adjust for the new time me.currentTimeTimer = setTimeout(update, interval); diff --git a/test/timeline.html b/test/timeline.html index 9cc1f384..7887b340 100644 --- a/test/timeline.html +++ b/test/timeline.html @@ -216,6 +216,10 @@ items.on('update', console.log.bind(console)); items.on('remove', console.log.bind(console)); + timeline.on('currentTimeTick', function () { + console.log('currentTimeTick') + }); + // timeline.setOptions({timeAxis:{scale: 'minute', step: 5}})