Browse Source

Function `setWindow` now accepts an object with properties `start` and `end`.

css_transitions
jos 10 years ago
parent
commit
13573b17dc
2 changed files with 19 additions and 9 deletions
  1. +4
    -4
      HISTORY.md
  2. +15
    -5
      src/timeline/Timeline.js

+ 4
- 4
HISTORY.md View File

@ -6,10 +6,10 @@ http://visjs.org
### Timeline
- Large refactoring of the Timeline code:
- Simplifications in the code.
- Performance improvements.
- Improved layout of box-items inside groups.
- Large refactoring of the Timeline, simplifying the code.
- Performance improvements.
- Improved layout of box-items inside groups.
- Function `setWindow` now accepts an object with properties `start` and `end`.
- Fixed option `autoResize` forcing a repaint of the Timeline with every check
rather than when the Timeline is actually resized.
- Fixed `select` event fired repeatedly when clicking an empty place on the

+ 15
- 5
src/timeline/Timeline.js View File

@ -534,21 +534,31 @@ Timeline.prototype.getSelection = function getSelection() {
/**
* Set the visible window. Both parameters are optional, you can change only
* start or only end.
* start or only end. Syntax:
*
* TimeLine.setWindow(start, end)
* TimeLine.setWindow(range)
*
* Where start and end can be a Date, number, or string, and range is an
* object with properties start and end.
*
* @param {Date | Number | String} [start] Start date of visible window
* @param {Date | Number | String} [end] End date of visible window
*/
// TODO: implement support for setWindow({start: ..., end: ...})
// TODO: rename setWindow to setRange?
Timeline.prototype.setWindow = function setWindow(start, end) {
this.range.setRange(start, end);
if (arguments.length == 1) {
var range = arguments[0];
this.range.setRange(range.start, range.end);
}
else {
this.range.setRange(start, end);
}
};
/**
* Get the visible window
* @return {{start: Date, end: Date}} Visible range
*/
// TODO: rename getWindow to getRange?
Timeline.prototype.getWindow = function setWindow() {
var range = this.range.getRange();
return {

Loading…
Cancel
Save