Browse Source

fixed moveTo, fit and setWindow. Improved animation smoothness

v3_develop
Alex de Mulder 10 years ago
parent
commit
15075b3edc
3 changed files with 25826 additions and 25818 deletions
  1. +25817
    -25813
      dist/vis.js
  2. +8
    -4
      lib/timeline/DateUtil.js
  3. +1
    -1
      lib/timeline/Range.js

+ 25817
- 25813
dist/vis.js
File diff suppressed because it is too large
View File


+ 8
- 4
lib/timeline/DateUtil.js View File

@ -32,6 +32,7 @@ exports.convertHiddenOptions = function(body, hiddenDates) {
}
}
// allowing multiple input formats
var periodicHiddenDates = hiddenDates.periodic;
if (periodicHiddenDates) {
if (periodicHiddenDates.times) {
@ -124,7 +125,10 @@ exports.updateHiddenDates = function (body, hiddenDates) {
}
}
}
// remove duplicates, merge where possible
exports.removeDuplicates(body);
// ensure the new positions are not on hidden dates
var startHidden = exports.isHidden(body.range.start, body.hiddenDates);
var endHidden = exports.isHidden(body.range.end,body.hiddenDates);
var rangeStart = body.range.start;
@ -342,19 +346,19 @@ exports.snapAwayFromHidden = function(hiddenTimes, range, start, end, delta, zoo
newDates = true;
// start from left, snap to right
if (range.previousDelta - delta > 0 && zoom == false || zoom == true && range.previousDelta - delta < 0) { // from the left
newStart = endDate + 1;
newStart = endDate + (start - startDate) + 1; // transfer the distance to the other side
}
else { // start from right, snap to left
newStart = startDate - 1;
newStart = startDate - (endDate - start) - 1; // transfer the distance to the other side
}
}
if (end >= startDate && end < endDate) { // if the end is entering a hidden zone
newDates = true;
if (range.previousDelta - delta < 0) { // end from right, snap to left
newEnd = startDate - 1;
newEnd = startDate - (endDate - end) - 1;
}
else { // end from left, snap to right
newEnd = endDate + 1;
newEnd = endDate + (end - startDate) + 1;
}
}
}

+ 1
- 1
lib/timeline/Range.js View File

@ -133,7 +133,7 @@ Range.prototype.setRange = function(start, end, animate) {
var e = (done || _end === null) ? _end : util.easeInOutQuad(time, initEnd, _end, duration);
changed = me._applyRange(s, e);
DateUtil.updateHiddenDates(this.body, this.options.hiddenDates);
DateUtil.updateHiddenDates(me.body, me.options.hiddenDates);
anyChanged = anyChanged || changed;
if (changed) {
me.body.emitter.emit('rangechange', {start: new Date(me.start), end: new Date(me.end)});

Loading…
Cancel
Save