Skip to content

Commit

Permalink
fix bounds changing when updating eraser
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaMan123 committed Jun 10, 2021
1 parent ed60524 commit e2c6774
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/mixins/eraser_brush.mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,22 @@

var __restoreObjectsState = fabric.Group.prototype._restoreObjectsState;
var _groupToObject = fabric.Group.prototype.toObject;
var __getBounds = fabric.Group.prototype._getBounds;
fabric.util.object.extend(fabric.Group.prototype, {

/**
* If group is an eraser then dimensions should not change when paths are added or removed and should remain the size of the base rect
* @private
*/
_getBounds: function (aX, aY, onlyWidthHeight) {
if (this.eraser) {
this.width = this._objects[0].width;
this.height = this._objects[0].height;
return;
}
__getBounds.call(this, aX, aY, onlyWidthHeight);
},

/**
* @private
* @param {fabric.Path} path
Expand Down

0 comments on commit e2c6774

Please sign in to comment.