Browse Source

fixed all problems with hiddenDates

v3_develop
Alex de Mulder 9 years ago
parent
commit
5cd6a2c9a2
4 changed files with 19 additions and 6 deletions
  1. +2
    -1
      HISTORY.md
  2. +8
    -2
      dist/vis.js
  3. +1
    -1
      examples/timeline/29_hiding_times.html
  4. +8
    -2
      lib/timeline/DateUtil.js

+ 2
- 1
HISTORY.md View File

@ -6,7 +6,8 @@ http://visjs.org
### Timeline
- Fixed uneven stepsized with hidden dates
- Fixed uneven stepsized with hidden dates.
- Fixed multiple bugs with regards to hidden dates.
## 2014-10-21, version 3.6.0

+ 8
- 2
dist/vis.js View File

@ -12622,14 +12622,21 @@ return /******/ (function(modules) { // webpackBootstrap
var totalRange = (body.range.end - body.range.start);
var pixelTime = totalRange / body.domProps.centerContainer.width;
for (var i = 0; i < hiddenDates.length; i++) {
if (hiddenDates[i].repeat !== undefined) {
var startDate = moment(hiddenDates[i].start);
var endDate = moment(hiddenDates[i].end);
if (startDate._d == "Invalid Date") {
throw new Error("Supplied start date is not valid: " + hiddenDates[i].start);
}
if (endDate._d == "Invalid Date") {
throw new Error("Supplied end date is not valid: " + hiddenDates[i].end);
}
var duration = endDate - startDate;
if (duration >= 4 * pixelTime) {
var offset = 0;
var runUntil = end.clone();
switch (hiddenDates[i].repeat) {
@ -12728,7 +12735,6 @@ return /******/ (function(modules) { // webpackBootstrap
}
// remove duplicates, merge where possible
exports.removeDuplicates(body);
//exports.printDates(body.hiddenDates)
// 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);

+ 1
- 1
examples/timeline/29_hiding_times.html View File

@ -33,7 +33,7 @@
hiddenDates: [
{start: '2014-03-21 00:00:00', end: '2014-03-28 00:00:00'},
{start: '2013-10-26 00:00:00', end: '2013-10-28 00:00:00', repeat: 'weekly'}, // daily weekly monthly yearly
{start: '2013-03-29 20:00:00', end: '2013-03-30 9:00:00', repeat: 'daily'} // daily weekly monthly yearly
{start: '2013-03-29 20:00:00', end: '2013-03-30 09:00:00', repeat: 'daily'} // daily weekly monthly yearly
],
start: '2014-04-17',
end: '2014-05-01',

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

@ -44,14 +44,21 @@ exports.updateHiddenDates = function (body, hiddenDates) {
var totalRange = (body.range.end - body.range.start);
var pixelTime = totalRange / body.domProps.centerContainer.width;
for (var i = 0; i < hiddenDates.length; i++) {
if (hiddenDates[i].repeat !== undefined) {
var startDate = moment(hiddenDates[i].start);
var endDate = moment(hiddenDates[i].end);
if (startDate._d == "Invalid Date") {
throw new Error("Supplied start date is not valid: " + hiddenDates[i].start);
}
if (endDate._d == "Invalid Date") {
throw new Error("Supplied end date is not valid: " + hiddenDates[i].end);
}
var duration = endDate - startDate;
if (duration >= 4 * pixelTime) {
var offset = 0;
var runUntil = end.clone();
switch (hiddenDates[i].repeat) {
@ -150,7 +157,6 @@ exports.updateHiddenDates = function (body, hiddenDates) {
}
// remove duplicates, merge where possible
exports.removeDuplicates(body);
//exports.printDates(body.hiddenDates)
// 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);

Loading…
Cancel
Save