Skip to content

Commit

Permalink
improved docs, fixed dirty on group destroy (#4293)
Browse files Browse the repository at this point in the history
  • Loading branch information
asturur authored Sep 7, 2017
1 parent 7cc16fb commit ca281dd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/mixins/collection.mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
5 changes: 5 additions & 0 deletions src/shapes/group.class.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
},

Expand Down

0 comments on commit ca281dd

Please sign in to comment.