|
@ -54,7 +54,7 @@ function ItemSet(timeline, options) { |
|
|
this.groupIds = []; |
|
|
this.groupIds = []; |
|
|
|
|
|
|
|
|
this.selection = []; // list with the ids of all selected nodes
|
|
|
this.selection = []; // list with the ids of all selected nodes
|
|
|
this.stackDirty = true; // if true, all items will be restacked on next repaint
|
|
|
|
|
|
|
|
|
this.stackDirty = true; // if true, all items will be restacked on next redraw
|
|
|
|
|
|
|
|
|
this.touchParams = {}; // stores properties while dragging
|
|
|
this.touchParams = {}; // stores properties while dragging
|
|
|
// create the HTML DOM
|
|
|
// create the HTML DOM
|
|
@ -148,7 +148,7 @@ ItemSet.prototype._create = function _create(){ |
|
|
ItemSet.prototype.setOptions = Component.prototype.setOptions; |
|
|
ItemSet.prototype.setOptions = Component.prototype.setOptions; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* Mark the ItemSet dirty so it will refresh everything with next repaint |
|
|
|
|
|
|
|
|
* Mark the ItemSet dirty so it will refresh everything with next redraw |
|
|
*/ |
|
|
*/ |
|
|
ItemSet.prototype.markDirty = function markDirty() { |
|
|
ItemSet.prototype.markDirty = function markDirty() { |
|
|
this.groupIds = []; |
|
|
this.groupIds = []; |
|
@ -258,7 +258,7 @@ ItemSet.prototype._deselect = function _deselect(id) { |
|
|
* Repaint the component |
|
|
* Repaint the component |
|
|
* @return {boolean} Returns true if the component is resized |
|
|
* @return {boolean} Returns true if the component is resized |
|
|
*/ |
|
|
*/ |
|
|
ItemSet.prototype.repaint = function repaint() { |
|
|
|
|
|
|
|
|
ItemSet.prototype.redraw = function redraw() { |
|
|
var margin = this.options.margin, |
|
|
var margin = this.options.margin, |
|
|
range = this.timeline.range, |
|
|
range = this.timeline.range, |
|
|
asSize = util.option.asSize, |
|
|
asSize = util.option.asSize, |
|
@ -286,7 +286,7 @@ ItemSet.prototype.repaint = function repaint() { |
|
|
this.lastVisibleInterval = visibleInterval; |
|
|
this.lastVisibleInterval = visibleInterval; |
|
|
this.props.lastWidth = this.props.width; |
|
|
this.props.lastWidth = this.props.width; |
|
|
|
|
|
|
|
|
// repaint all groups
|
|
|
|
|
|
|
|
|
// redraw all groups
|
|
|
var restack = this.stackDirty, |
|
|
var restack = this.stackDirty, |
|
|
firstGroup = this._firstGroup(), |
|
|
firstGroup = this._firstGroup(), |
|
|
firstMargin = { |
|
|
firstMargin = { |
|
@ -301,7 +301,7 @@ ItemSet.prototype.repaint = function repaint() { |
|
|
minHeight = margin.axis + margin.item; |
|
|
minHeight = margin.axis + margin.item; |
|
|
util.forEach(this.groups, function (group) { |
|
|
util.forEach(this.groups, function (group) { |
|
|
var groupMargin = (group == firstGroup) ? firstMargin : nonFirstMargin; |
|
|
var groupMargin = (group == firstGroup) ? firstMargin : nonFirstMargin; |
|
|
resized = group.repaint(range, groupMargin, restack) || resized; |
|
|
|
|
|
|
|
|
resized = group.redraw(range, groupMargin, restack) || resized; |
|
|
height += group.height; |
|
|
height += group.height; |
|
|
}); |
|
|
}); |
|
|
height = Math.max(height, minHeight); |
|
|
height = Math.max(height, minHeight); |
|
@ -462,7 +462,7 @@ ItemSet.prototype.setGroups = function setGroups(groups) { |
|
|
// remove all drawn groups
|
|
|
// remove all drawn groups
|
|
|
ids = this.groupsData.getIds(); |
|
|
ids = this.groupsData.getIds(); |
|
|
this.groupsData = null; |
|
|
this.groupsData = null; |
|
|
this._onRemoveGroups(ids); // note: this will cause a repaint
|
|
|
|
|
|
|
|
|
this._onRemoveGroups(ids); // note: this will cause a redraw
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// replace the dataset
|
|
|
// replace the dataset
|
|
@ -571,7 +571,7 @@ ItemSet.prototype._onUpdate = function _onUpdate(ids) { |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
this._order(); |
|
|
this._order(); |
|
|
this.stackDirty = true; // force re-stacking of all items next repaint
|
|
|
|
|
|
|
|
|
this.stackDirty = true; // force re-stacking of all items next redraw
|
|
|
this.timeline.emitter.emit('change'); |
|
|
this.timeline.emitter.emit('change'); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
@ -601,7 +601,7 @@ ItemSet.prototype._onRemove = function _onRemove(ids) { |
|
|
if (count) { |
|
|
if (count) { |
|
|
// update order
|
|
|
// update order
|
|
|
this._order(); |
|
|
this._order(); |
|
|
this.stackDirty = true; // force re-stacking of all items next repaint
|
|
|
|
|
|
|
|
|
this.stackDirty = true; // force re-stacking of all items next redraw
|
|
|
this.timeline.emitter.emit('change'); |
|
|
this.timeline.emitter.emit('change'); |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
@ -756,7 +756,7 @@ ItemSet.prototype._updateItem = function _updateItem(item, itemData) { |
|
|
|
|
|
|
|
|
item.data = itemData; |
|
|
item.data = itemData; |
|
|
if (item.displayed) { |
|
|
if (item.displayed) { |
|
|
item.repaint(); |
|
|
|
|
|
|
|
|
item.redraw(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// update group
|
|
|
// update group
|
|
@ -936,7 +936,7 @@ ItemSet.prototype._onDrag = function (event) { |
|
|
|
|
|
|
|
|
// TODO: implement onMoving handler
|
|
|
// TODO: implement onMoving handler
|
|
|
|
|
|
|
|
|
this.stackDirty = true; // force re-stacking of all items next repaint
|
|
|
|
|
|
|
|
|
this.stackDirty = true; // force re-stacking of all items next redraw
|
|
|
this.timeline.emitter.emit('change'); |
|
|
this.timeline.emitter.emit('change'); |
|
|
|
|
|
|
|
|
event.stopPropagation(); |
|
|
event.stopPropagation(); |
|
@ -986,7 +986,7 @@ ItemSet.prototype._onDragEnd = function (event) { |
|
|
if ('start' in props) props.item.data.start = props.start; |
|
|
if ('start' in props) props.item.data.start = props.start; |
|
|
if ('end' in props) props.item.data.end = props.end; |
|
|
if ('end' in props) props.item.data.end = props.end; |
|
|
|
|
|
|
|
|
me.stackDirty = true; // force re-stacking of all items next repaint
|
|
|
|
|
|
|
|
|
me.stackDirty = true; // force re-stacking of all items next redraw
|
|
|
me.timeline.emitter.emit('change'); |
|
|
me.timeline.emitter.emit('change'); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|