diff --git a/src/mixins/collection.mixin.js b/src/mixins/collection.mixin.js index fbd7ae1156b..a928448608b 100644 --- a/src/mixins/collection.mixin.js +++ b/src/mixins/collection.mixin.js @@ -10,6 +10,9 @@ fabric.Collection = { * (if `renderOnAddRemove` is not `false`). * in case of Group no changes to bounding box are made. * Objects should be instances of (or inherit from) fabric.Object + * Use of this function is highly discouraged for groups. + * you can add a bunch of objects with the add method but then you NEED + * to run a addWithUpdate call for the Group class or position/bbox will be wrong. * @param {...fabric.Object} object Zero or more fabric instances * @return {Self} thisArg * @chainable @@ -28,6 +31,9 @@ fabric.Collection = { /** * Inserts an object into collection at specified index, then renders canvas (if `renderOnAddRemove` is not `false`) * An object should be an instance of (or inherit from) fabric.Object + * Use of this function is highly discouraged for groups. + * you can add a bunch of objects with the insertAt method but then you NEED + * to run a addWithUpdate call for the Group class or position/bbox will be wrong. * @param {Object} object Object to insert * @param {Number} index Index to insert object at * @param {Boolean} nonSplicing When `true`, no splicing (shifting) of objects occurs diff --git a/src/shapes/group.class.js b/src/shapes/group.class.js index feee3abf0dd..adfe4de8060 100644 --- a/src/shapes/group.class.js +++ b/src/shapes/group.class.js @@ -470,6 +470,11 @@ * @chainable */ destroy: function() { + // when group is destroyed objects needs to get a repaint to be eventually + // displayed on canvas. + this._objects.forEach(function(object) { + object.set('dirty', true); + }); return this._restoreObjectsState(); },