Skip to content

Commit

Permalink
extends canvas with setErasable
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaMan123 committed Apr 8, 2021
1 parent 21f5289 commit 07481ba
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/brushes/eraser_brush.class.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,26 @@
}
});

fabric.util.object.extend(fabric.Canvas.prototype, {
/**
* Sets eraable option on background objects
* @param {boolean} value
* @returns
*/
setErasable(value) {
let changed = false;
if (this.backgroundImage) {
changed = true;
this.backgroundImage.erasable = value;
}
if (this.backgroundColor && this.backgroundColor instanceof fabric.Object) {
changed = true;
this.backgroundColor.erasable = value;
}
return changed;
}
});

/**
* EraserBrush class
* @class fabric.EraserBrush
Expand Down

0 comments on commit 07481ba

Please sign in to comment.