Skip to content

Commit

Permalink
invalidate groups after active selection change
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaMan123 committed Apr 4, 2022
1 parent e9afc89 commit d8f8251
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/shapes/active_selection.class.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,30 @@
}
},

/**
* @private
* @param {'added'|'removed'} type
* @param {fabric.Object[]} targets
*/
_onAfterObjectsChange: function (type, targets) {
var groups = [];
targets.forEach(function (object) {
object.group && !groups.includes(object.group) && groups.push(object.group);
});
if (type === 'removed') {
// invalidate groups' layout and mark as dirty
groups.forEach(function (group) {
group._onAfterObjectsChange('added', targets);
});
}
else {
// mark groups as dirty
groups.forEach(function (group) {
group._set('dirty', true);
});
}
},

/**
* If returns true, deselection is cancelled.
* @since 2.0.0
Expand Down

0 comments on commit d8f8251

Please sign in to comment.