From ea91efe810a0a86ed27e13e94226e1da7597d1ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Thu, 11 Apr 2019 19:38:12 +0200 Subject: [PATCH] Add Raster.clear() to clear associated canvas --- src/item/Raster.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/item/Raster.js b/src/item/Raster.js index 856e0ee6..b150504d 100644 --- a/src/item/Raster.js +++ b/src/item/Raster.js @@ -680,6 +680,14 @@ var Raster = Item.extend(/** @lends Raster# */{ ctx.putImageData(imageData, point.x, point.y); }, + /** + * Clears the image, if it is backed by a canvas. + */ + clear: function() { + var size = this._size; + this.getContext().clearRect(0, 0, size.width + 1, size.height + 1); + }, + // DOCS: document Raster#createImageData /** * {@grouptitle Image Data}