Browse Source

Fixed #1118: since v4.6.0, grid of time axis was wrongly positioned on some scales

flowchartTest
jos 9 years ago
parent
commit
116244c421
2 changed files with 8 additions and 6 deletions
  1. +4
    -2
      HISTORY.md
  2. +4
    -4
      lib/timeline/TimeStep.js

+ 4
- 2
HISTORY.md View File

@ -5,8 +5,10 @@ http://visjs.org
### Timeline
- Items keep their group offset while dragging items located in multiple groups.
Thanks @Fice.
- Fixed #192: Items keep their group offset while dragging items located in
multiple groups. Thanks @Fice.
- Fixed #1118: since v4.6.0, grid of time axis was wrongly positioned on some
scales.
## 2015-07-22, version 4.6.0

+ 4
- 4
lib/timeline/TimeStep.js View File

@ -164,9 +164,9 @@ TimeStep.prototype.roundToMinor = function() {
case 'minute': this.current.subtract(this.current.minutes() % this.step, 'minutes'); break;
case 'hour': this.current.subtract(this.current.hours() % this.step, 'hours'); break;
case 'weekday': // intentional fall through
case 'day': this.current.subtract((this.current.date() - 1) % this.step); break;
case 'month': this.current.subtract(this.current.month() % this.step); break;
case 'year': this.current.subtract(this.current.year() % this.step); break;
case 'day': this.current.subtract((this.current.date() - 1) % this.step, 'day'); break;
case 'month': this.current.subtract(this.current.month() % this.step, 'month'); break;
case 'year': this.current.subtract(this.current.year() % this.step, 'year'); break;
default: break;
}
}
@ -197,7 +197,7 @@ TimeStep.prototype.next = function() {
this.current.add(this.step, 'hour');
// in case of skipping an hour for daylight savings, adjust the hour again (else you get: 0h 5h 9h ... instead of 0h 4h 8h ...)
// TODO: is this still needed now we use the function of moment.js?
this.current.subtract(this.current.hours() % this.step);
this.current.subtract(this.current.hours() % this.step, 'hour');
break;
case 'weekday': // intentional fall through
case 'day': this.current.add(this.step, 'day'); break;

Loading…
Cancel
Save