Browse Source

Fixed #122: a bug wrongly rendering invisible items after updating them.

css_transitions
jos 10 years ago
parent
commit
54dcb0268e
4 changed files with 46 additions and 19 deletions
  1. +1
    -0
      HISTORY.md
  2. +36
    -12
      dist/vis.js
  3. +6
    -6
      dist/vis.min.js
  4. +3
    -1
      src/timeline/component/ItemSet.js

+ 1
- 0
HISTORY.md View File

@ -7,6 +7,7 @@ http://visjs.org
### Timeline ### Timeline
- Fixed width of items with type `rangeoverflow`. - Fixed width of items with type `rangeoverflow`.
- Fixed a bug wrongly rendering invisible items after updating them.
### Graph ### Graph

+ 36
- 12
dist/vis.js View File

@ -5,7 +5,7 @@
* A dynamic, browser-based visualization library. * A dynamic, browser-based visualization library.
* *
* @version 1.0.1-SNAPSHOT * @version 1.0.1-SNAPSHOT
* @date 2014-05-02
* @date 2014-05-09
* *
* @license * @license
* Copyright (C) 2011-2014 Almende B.V, http://almende.com * Copyright (C) 2011-2014 Almende B.V, http://almende.com
@ -417,7 +417,7 @@ util.extend = function (a, b) {
util.equalArray = function (a, b) { util.equalArray = function (a, b) {
if (a.length != b.length) return false; if (a.length != b.length) return false;
for (var i = 1, len = a.length; i < len; i++) {
for (var i = 0, len = a.length; i < len; i++) {
if (a[i] != b[i]) return false; if (a[i] != b[i]) return false;
} }
@ -2595,7 +2595,7 @@ stack.collision = function collision (a, b, margin) {
* @param {Date} [end] The end date * @param {Date} [end] The end date
* @param {Number} [minimumStep] Optional. Minimum step size in milliseconds * @param {Number} [minimumStep] Optional. Minimum step size in milliseconds
*/ */
TimeStep = function(start, end, minimumStep) {
function TimeStep(start, end, minimumStep) {
// variables // variables
this.current = new Date(); this.current = new Date();
this._start = new Date(); this._start = new Date();
@ -2607,7 +2607,7 @@ TimeStep = function(start, end, minimumStep) {
// initialize the range // initialize the range
this.setRange(start, end, minimumStep); this.setRange(start, end, minimumStep);
};
}
/// enum scale /// enum scale
TimeStep.SCALE = { TimeStep.SCALE = {
@ -5484,7 +5484,9 @@ ItemSet.prototype._updateItem = function _updateItem(item, itemData) {
var oldGroupId = item.data.group; var oldGroupId = item.data.group;
item.data = itemData; item.data = itemData;
item.repaint();
if (item.displayed) {
item.repaint();
}
// update group // update group
if (oldGroupId != item.data.group) { if (oldGroupId != item.data.group) {
@ -6677,9 +6679,10 @@ ItemRangeOverflow.prototype.repositionX = function repositionX() {
this.left = start; this.left = start;
var boxWidth = Math.max(end - start, 1); var boxWidth = Math.max(end - start, 1);
this.width = (this.props.content.width < boxWidth) ?
boxWidth :
start + contentLeft + this.props.content.width;
this.width = boxWidth + this.props.content.width;
// Note: The calculation of width is an optimistic calculation, giving
// a width which will not change when moving the Timeline
// So no restacking needed, which is nicer for the eye
this.dom.box.style.left = this.left + 'px'; this.dom.box.style.left = this.left + 'px';
this.dom.box.style.width = boxWidth + 'px'; this.dom.box.style.width = boxWidth + 'px';
@ -10779,10 +10782,10 @@ Popup.prototype.hide = function () {
* @class Groups * @class Groups
* This class can store groups and properties specific for groups. * This class can store groups and properties specific for groups.
*/ */
Groups = function () {
function Groups() {
this.clear(); this.clear();
this.defaultIndex = 0; this.defaultIndex = 0;
};
}
/** /**
@ -10860,11 +10863,11 @@ Groups.prototype.add = function (groupname, style) {
* @class Images * @class Images
* This class loads images and keeps them stored. * This class loads images and keeps them stored.
*/ */
Images = function () {
function Images() {
this.images = {}; this.images = {};
this.callback = undefined; this.callback = undefined;
};
}
/** /**
* Set an onload callback function. This will be called each time an image * Set an onload callback function. This will be called each time an image
@ -17273,6 +17276,27 @@ Graph.prototype._yToCanvas = function(y) {
return y * this.scale + this.translation.y ; return y * this.scale + this.translation.y ;
}; };
/**
*
* @param {object} pos = {x: number, y: number}
* @returns {{x: number, y: number}}
* @constructor
*/
Graph.prototype.DOMtoCanvas = function(pos) {
return {x:this._xToCanvas(pos.x),y:this._yToCanvas(pos.y)};
}
/**
*
* @param {object} pos = {x: number, y: number}
* @returns {{x: number, y: number}}
* @constructor
*/
Graph.prototype.canvasToDOM = function(pos) {
return {x:this._canvasToX(pos.x),y:this._canvasToY(pos.y)};
}
/** /**
* Redraw all nodes * Redraw all nodes
* The 2d context of a HTML canvas can be retrieved by canvas.getContext('2d'); * The 2d context of a HTML canvas can be retrieved by canvas.getContext('2d');

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


+ 3
- 1
src/timeline/component/ItemSet.js View File

@ -813,7 +813,9 @@ ItemSet.prototype._updateItem = function _updateItem(item, itemData) {
var oldGroupId = item.data.group; var oldGroupId = item.data.group;
item.data = itemData; item.data = itemData;
item.repaint();
if (item.displayed) {
item.repaint();
}
// update group // update group
if (oldGroupId != item.data.group) { if (oldGroupId != item.data.group) {

Loading…
Cancel
Save