Browse Source

Fixed #1683: implemented `currentTimeTick` event

codeClimate
jos 8 years ago
parent
commit
448734ceb9
5 changed files with 17 additions and 0 deletions
  1. +1
    -0
      HISTORY.md
  2. +6
    -0
      docs/graph2d/index.html
  3. +5
    -0
      docs/timeline/index.html
  4. +1
    -0
      lib/timeline/component/CurrentTime.js
  5. +4
    -0
      test/timeline.html

+ 1
- 0
HISTORY.md View File

@ -6,6 +6,7 @@ http://visjs.org
### Timeline ### Timeline
- Implemented `currentTimeTick` event (see #1683).
- Fixed #1630: method `getItemRange` missing in docs. - Fixed #1630: method `getItemRange` missing in docs.
### Graph2d ### Graph2d

+ 6
- 0
docs/graph2d/index.html View File

@ -1304,6 +1304,12 @@ Graph2d.off('rangechanged', onChange);
<th>Properties</th> <th>Properties</th>
<th>Description</th> <th>Description</th>
</tr> </tr>
<tr>
<td>currentTimeTick</td>
<td>Fired when the current time bar redraws. The rate depends on the zoom level.</td>
</tr>
<tr> <tr>
<td>click</td> <td>click</td>
<td> <td>

+ 5
- 0
docs/timeline/index.html View File

@ -1348,6 +1348,11 @@ timeline.off('select', onSelect);
<th>Description</th> <th>Description</th>
</tr> </tr>
<tr>
<td>currentTimeTick</td>
<td>Fired when the current time bar redraws. The rate depends on the zoom level.</td>
</tr>
<tr> <tr>
<td>click</td> <td>click</td>
<td> <td>

+ 1
- 0
lib/timeline/component/CurrentTime.js View File

@ -129,6 +129,7 @@ CurrentTime.prototype.start = function() {
if (interval > 1000) interval = 1000; if (interval > 1000) interval = 1000;
me.redraw(); me.redraw();
me.body.emitter.emit('currentTimeTick');
// start a renderTimer to adjust for the new time // start a renderTimer to adjust for the new time
me.currentTimeTimer = setTimeout(update, interval); me.currentTimeTimer = setTimeout(update, interval);

+ 4
- 0
test/timeline.html View File

@ -216,6 +216,10 @@
items.on('update', console.log.bind(console)); items.on('update', console.log.bind(console));
items.on('remove', 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}}) // timeline.setOptions({timeAxis:{scale: 'minute', step: 5}})
</script> </script>

Loading…
Cancel
Save