Browse Source

Added function `repaint()` to force a repaint of the Timeline.

css_transitions
jos 10 years ago
parent
commit
c0614edb84
4 changed files with 19 additions and 4 deletions
  1. +1
    -0
      HISTORY.md
  2. +8
    -2
      docs/timeline.html
  3. +2
    -2
      examples/timeline/16_navigation_menu.html
  4. +8
    -0
      src/timeline/Timeline.js

+ 1
- 0
HISTORY.md View File

@ -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)`.

+ 8
- 2
docs/timeline.html View File

@ -341,8 +341,7 @@ var options = {
<td>autoResize</td>
<td>boolean</td>
<td>true</td>
<td>If true, the Timeline will automatically detect when its
container is resized, and redraw itself accordingly.</td>
<td>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 <code>repaint()</code>.</td>
</tr>
<tr>
@ -679,6 +678,13 @@ var options = {
<td>Remove an event listener created before via function <code>on(event, callback)</code>. See section <a href="#Events">Events for more information</a>.</td>
</tr>
<tr>
<td>repaint()</td>
<td>none</td>
<td>Force a repaint of the Timeline. Can be useful to manually repaint when option autoResize=false.
</td>
</tr>
<tr>
<td>setGroups(groups)</td>
<td>none</td>

+ 2
- 2
examples/timeline/16_navigation_menu.html View File

@ -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();

+ 8
- 0
src/timeline/Timeline.js View File

@ -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

Loading…
Cancel
Save