|
@ -14,6 +14,7 @@ function Group (groupId, data, itemSet) { |
|
|
this.subgroupIndex = 0; |
|
|
this.subgroupIndex = 0; |
|
|
this.subgroupOrderer = data && data.subgroupOrder; |
|
|
this.subgroupOrderer = data && data.subgroupOrder; |
|
|
this.itemSet = itemSet; |
|
|
this.itemSet = itemSet; |
|
|
|
|
|
this.isVisible = null; |
|
|
|
|
|
|
|
|
this.dom = {}; |
|
|
this.dom = {}; |
|
|
this.props = { |
|
|
this.props = { |
|
@ -180,6 +181,8 @@ Group.prototype.redraw = function(range, margin, restack) { |
|
|
// recalculate the height of the subgroups
|
|
|
// recalculate the height of the subgroups
|
|
|
this._calculateSubGroupHeights(); |
|
|
this._calculateSubGroupHeights(); |
|
|
|
|
|
|
|
|
|
|
|
this.isVisible = this._isGroupVisible(range); |
|
|
|
|
|
|
|
|
// reposition visible items vertically
|
|
|
// reposition visible items vertically
|
|
|
if (typeof this.itemSet.options.order === 'function') { |
|
|
if (typeof this.itemSet.options.order === 'function') { |
|
|
// a custom order function
|
|
|
// a custom order function
|
|
@ -219,6 +222,10 @@ Group.prototype.redraw = function(range, margin, restack) { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!this.isVisible && this.height) { |
|
|
|
|
|
return resized = false; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// recalculate the height of the group
|
|
|
// recalculate the height of the group
|
|
|
var height = this._calculateHeight(margin); |
|
|
var height = this._calculateHeight(margin); |
|
|
|
|
|
|
|
@ -265,6 +272,17 @@ Group.prototype._calculateSubGroupHeights = function () { |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* check if group is visible |
|
|
|
|
|
* @private |
|
|
|
|
|
*/ |
|
|
|
|
|
Group.prototype._isGroupVisible = function (range) { |
|
|
|
|
|
var isVisible = |
|
|
|
|
|
(this.top < range.body.domProps.centerContainer.height - range.body.domProps.scrollTop) && |
|
|
|
|
|
(this.top + this.height > - range.body.domProps.scrollTop); |
|
|
|
|
|
return isVisible; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* recalculate the height of the group |
|
|
* recalculate the height of the group |
|
|
* @param {{item: {horizontal: number, vertical: number}, axis: number}} margin |
|
|
* @param {{item: {horizontal: number, vertical: number}, axis: number}} margin |
|
@ -475,6 +493,15 @@ Group.prototype.order = function() { |
|
|
Group.prototype._updateVisibleItems = function(orderedItems, oldVisibleItems, range) { |
|
|
Group.prototype._updateVisibleItems = function(orderedItems, oldVisibleItems, range) { |
|
|
var visibleItems = []; |
|
|
var visibleItems = []; |
|
|
var visibleItemsLookup = {}; // we keep this to quickly look up if an item already exists in the list without using indexOf on visibleItems
|
|
|
var visibleItemsLookup = {}; // we keep this to quickly look up if an item already exists in the list without using indexOf on visibleItems
|
|
|
|
|
|
|
|
|
|
|
|
if (!this.isVisible) { |
|
|
|
|
|
for (i = 0; i < oldVisibleItems.length; i++) { |
|
|
|
|
|
item = oldVisibleItems[i]; |
|
|
|
|
|
if (item.displayed) item.hide(); |
|
|
|
|
|
} |
|
|
|
|
|
return visibleItems; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
var interval = (range.end - range.start) / 4; |
|
|
var interval = (range.end - range.start) / 4; |
|
|
var lowerBound = range.start - interval; |
|
|
var lowerBound = range.start - interval; |
|
|
var upperBound = range.end + interval; |
|
|
var upperBound = range.end + interval; |
|
|