|
@ -177,6 +177,9 @@ Group.prototype.redraw = function(range, margin, restack) { |
|
|
restack = true; |
|
|
restack = true; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// recalculate the height of the subgroups
|
|
|
|
|
|
this._calculateSubGroupHeights(); |
|
|
|
|
|
|
|
|
// 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
|
|
@ -244,6 +247,25 @@ Group.prototype.redraw = function(range, margin, restack) { |
|
|
return resized; |
|
|
return resized; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* recalculate the height of the subgroups |
|
|
|
|
|
* @private |
|
|
|
|
|
*/ |
|
|
|
|
|
Group.prototype._calculateSubGroupHeights = function () { |
|
|
|
|
|
if (Object.keys(this.subgroups).length > 0) { |
|
|
|
|
|
var me = this; |
|
|
|
|
|
|
|
|
|
|
|
this.resetSubgroups(); |
|
|
|
|
|
|
|
|
|
|
|
util.forEach(this.visibleItems, function (item) { |
|
|
|
|
|
if (item.data.subgroup !== undefined) { |
|
|
|
|
|
me.subgroups[item.data.subgroup].height = Math.max(me.subgroups[item.data.subgroup].height, item.height); |
|
|
|
|
|
me.subgroups[item.data.subgroup].visible = true; |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 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 |
|
@ -254,20 +276,12 @@ Group.prototype._calculateHeight = function (margin) { |
|
|
// recalculate the height of the group
|
|
|
// recalculate the height of the group
|
|
|
var height; |
|
|
var height; |
|
|
var visibleItems = this.visibleItems; |
|
|
var visibleItems = this.visibleItems; |
|
|
//var visibleSubgroups = [];
|
|
|
|
|
|
//this.visibleSubgroups = 0;
|
|
|
|
|
|
this.resetSubgroups(); |
|
|
|
|
|
var me = this; |
|
|
|
|
|
if (visibleItems.length > 0) { |
|
|
if (visibleItems.length > 0) { |
|
|
var min = visibleItems[0].top; |
|
|
var min = visibleItems[0].top; |
|
|
var max = visibleItems[0].top + visibleItems[0].height; |
|
|
var max = visibleItems[0].top + visibleItems[0].height; |
|
|
util.forEach(visibleItems, function (item) { |
|
|
util.forEach(visibleItems, function (item) { |
|
|
min = Math.min(min, item.top); |
|
|
min = Math.min(min, item.top); |
|
|
max = Math.max(max, (item.top + item.height)); |
|
|
max = Math.max(max, (item.top + item.height)); |
|
|
if (item.data.subgroup !== undefined) { |
|
|
|
|
|
me.subgroups[item.data.subgroup].height = Math.max(me.subgroups[item.data.subgroup].height,item.height); |
|
|
|
|
|
me.subgroups[item.data.subgroup].visible = true; |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
}); |
|
|
if (min > margin.axis) { |
|
|
if (min > margin.axis) { |
|
|
// there is an empty gap between the lowest item and the axis
|
|
|
// there is an empty gap between the lowest item and the axis
|
|
|