Browse Source

updated major step for hidden dates

v3_develop
Alex de Mulder 10 years ago
parent
commit
51931b2b5e
3 changed files with 23736 additions and 23678 deletions
  1. +23703
    -23674
      dist/vis.js
  2. +5
    -3
      lib/timeline/DateUtil.js
  3. +28
    -1
      lib/timeline/TimeStep.js

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


+ 5
- 3
lib/timeline/DateUtil.js View File

@ -199,9 +199,11 @@ exports.stepOverHiddenDates = function(timeStep, previousTime) {
if (stepInHidden == true && currentValue < timeStep._end.valueOf() && currentValue != previousTime) {
var prevValue = moment(previousTime);
var newValue = moment(endDate);
if (prevValue.dayOfYear() != newValue.dayOfYear()) {
timeStep.switchedDay = true;
}
//check if the next step should be major
if (prevValue.year() != newValue.year()) {timeStep.switchedYear = true;}
else if (prevValue.month() != newValue.month()) {timeStep.switchedMonth = true;}
else if (prevValue.dayOfYear() != newValue.dayOfYear()) {timeStep.switchedDay = true;}
timeStep.current = newValue.toDate();
}
};

+ 28
- 1
lib/timeline/TimeStep.js View File

@ -42,6 +42,8 @@ function TimeStep(start, end, minimumStep, hiddenDates) {
// hidden Dates options
this.switchedDay = false;
this.switchedMonth = false;
this.switchedYear = false;
this.hiddenDates = hiddenDates;
if (hiddenDates === undefined) {
this.hiddenDates = [];
@ -404,7 +406,31 @@ TimeStep.prototype.snap = function(date) {
* @return {boolean} true if current date is major, else false.
*/
TimeStep.prototype.isMajor = function() {
if (this.switchedDay == true) {
if (this.switchedYear == true) {
this.switchedYear = false;
switch (this.scale) {
case TimeStep.SCALE.YEAR:
case TimeStep.SCALE.MONTH:
case TimeStep.SCALE.WEEKDAY:
case TimeStep.SCALE.DAY:
return true;
default:
return false;
}
}
else if (this.switchedMonth == true) {
this.switchedMonth = false;
switch (this.scale) {
case TimeStep.SCALE.YEAR:
case TimeStep.SCALE.MONTH:
case TimeStep.SCALE.WEEKDAY:
case TimeStep.SCALE.DAY:
return true;
default:
return false;
}
}
else if (this.switchedDay == true) {
this.switchedDay = false;
switch (this.scale) {
case TimeStep.SCALE.MILLISECOND:
@ -417,6 +443,7 @@ TimeStep.prototype.isMajor = function() {
}
}
switch (this.scale) {
case TimeStep.SCALE.MILLISECOND:
return (this.current.getMilliseconds() == 0);

Loading…
Cancel
Save