Browse Source

Added loop protetion for Timeline redrawing (see #450)

v3_develop
jos 10 years ago
parent
commit
0efdfa3915
4 changed files with 24 additions and 10 deletions
  1. +11
    -4
      dist/vis.js
  2. +1
    -1
      dist/vis.map
  3. +1
    -1
      dist/vis.min.js
  4. +11
    -4
      lib/timeline/Core.js

+ 11
- 4
dist/vis.js View File

@ -21301,9 +21301,6 @@ return /******/ (function(modules) { // webpackBootstrap
var DataSet = __webpack_require__(3); var DataSet = __webpack_require__(3);
var DataView = __webpack_require__(4); var DataView = __webpack_require__(4);
var Range = __webpack_require__(17); var Range = __webpack_require__(17);
var TimeAxis = __webpack_require__(30);
var CurrentTime = __webpack_require__(21);
var CustomTime = __webpack_require__(22);
var ItemSet = __webpack_require__(27); var ItemSet = __webpack_require__(27);
var Activator = __webpack_require__(55); var Activator = __webpack_require__(55);
var DateUtil = __webpack_require__(15); var DateUtil = __webpack_require__(15);
@ -21453,6 +21450,8 @@ return /******/ (function(modules) { // webpackBootstrap
}; };
this.touch = {}; // store state information needed for touch events this.touch = {}; // store state information needed for touch events
this.redrawCount = 0;
// attach the root panel to the provided container // attach the root panel to the provided container
if (!container) throw new Error('No container provided'); if (!container) throw new Error('No container provided');
container.appendChild(this.dom.root); container.appendChild(this.dom.root);
@ -21890,7 +21889,15 @@ return /******/ (function(modules) { // webpackBootstrap
}); });
if (resized) { if (resized) {
// keep repainting until all sizes are settled // keep repainting until all sizes are settled
this.redraw();
var MAX_REDRAWS = 2; // maximum number of consecutive redraws
if (this.redrawCount < MAX_REDRAWS) {
this.redrawCount++;
this.redraw();
}
else {
console.log('WARNING: infinite loop in redraw?')
}
this.redrawCount = 0;
} }
this.emit("finishedRedraw"); this.emit("finishedRedraw");

+ 1
- 1
dist/vis.map
File diff suppressed because it is too large
View File


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


+ 11
- 4
lib/timeline/Core.js View File

@ -4,9 +4,6 @@ var util = require('../util');
var DataSet = require('../DataSet'); var DataSet = require('../DataSet');
var DataView = require('../DataView'); var DataView = require('../DataView');
var Range = require('./Range'); var Range = require('./Range');
var TimeAxis = require('./component/TimeAxis');
var CurrentTime = require('./component/CurrentTime');
var CustomTime = require('./component/CustomTime');
var ItemSet = require('./component/ItemSet'); var ItemSet = require('./component/ItemSet');
var Activator = require('../shared/Activator'); var Activator = require('../shared/Activator');
var DateUtil = require('./DateUtil'); var DateUtil = require('./DateUtil');
@ -156,6 +153,8 @@ Core.prototype._create = function (container) {
}; };
this.touch = {}; // store state information needed for touch events this.touch = {}; // store state information needed for touch events
this.redrawCount = 0;
// attach the root panel to the provided container // attach the root panel to the provided container
if (!container) throw new Error('No container provided'); if (!container) throw new Error('No container provided');
container.appendChild(this.dom.root); container.appendChild(this.dom.root);
@ -593,7 +592,15 @@ Core.prototype.redraw = function() {
}); });
if (resized) { if (resized) {
// keep repainting until all sizes are settled // keep repainting until all sizes are settled
this.redraw();
var MAX_REDRAWS = 2; // maximum number of consecutive redraws
if (this.redrawCount < MAX_REDRAWS) {
this.redrawCount++;
this.redraw();
}
else {
console.log('WARNING: infinite loop in redraw?')
}
this.redrawCount = 0;
} }
this.emit("finishedRedraw"); this.emit("finishedRedraw");

Loading…
Cancel
Save