@ -246,6 +246,7 @@ Group.prototype.redraw = function(range, margin, forceRestack) {
var restack = forceRestack || this . stackDirty || ( this . isVisible && ! lastIsVisible ) ;
var restack = forceRestack || this . stackDirty || ( this . isVisible && ! lastIsVisible ) ;
this . _updateSubgroupsSizes ( ) ;
// if restacking, reposition visible items vertically
// if restacking, reposition visible items vertically
if ( restack ) {
if ( restack ) {
if ( typeof this . itemSet . options . order === 'function' ) {
if ( typeof this . itemSet . options . order === 'function' ) {
@ -285,9 +286,6 @@ Group.prototype.redraw = function(range, margin, forceRestack) {
this . stackDirty = false ;
this . stackDirty = false ;
}
}
this . _updateSubgroupsSizes ( ) ;
// recalculate the height of the group
// recalculate the height of the group
var height = this . _calculateHeight ( margin ) ;
var height = this . _calculateHeight ( margin ) ;
@ -486,7 +484,7 @@ Group.prototype._updateSubgroupsSizes = function () {
if ( me . subgroups ) {
if ( me . subgroups ) {
for ( var subgroup in me . subgroups ) {
for ( var subgroup in me . subgroups ) {
var newStart = me . subgroups [ subgroup ] . items [ 0 ] . data . start ;
var newStart = me . subgroups [ subgroup ] . items [ 0 ] . data . start ;
var newEnd = me . subgroups [ subgroup ] . items [ 0 ] . data . end ;
var newEnd = me . subgroups [ subgroup ] . items [ 0 ] . data . end - 1 ;
me . subgroups [ subgroup ] . items . forEach ( function ( item ) {
me . subgroups [ subgroup ] . items . forEach ( function ( item ) {
if ( new Date ( item . data . start ) < new Date ( newStart ) ) {
if ( new Date ( item . data . start ) < new Date ( newStart ) ) {
@ -498,7 +496,7 @@ Group.prototype._updateSubgroupsSizes = function () {
} )
} )
me . subgroups [ subgroup ] . start = newStart ;
me . subgroups [ subgroup ] . start = newStart ;
me . subgroups [ subgroup ] . end = newEnd ;
me . subgroups [ subgroup ] . end = new Date ( newEnd - an class="mi ">1 ) // -1 to compensate for colliding end to start subgroups ;
}
}
}
}