From 38f4a10ed1aff251d39228ca2d0c4eb2745e95e8 Mon Sep 17 00:00:00 2001 From: Anders Gustafsson Date: Thu, 7 Jun 2018 15:15:41 +0200 Subject: [PATCH] P5-2705 - public crop function can now remove aperture transparency --- dist/image-editor.js | 8 +++++++- src/ImageEditor.js | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/dist/image-editor.js b/dist/image-editor.js index e7cc55a..3780c88 100644 --- a/dist/image-editor.js +++ b/dist/image-editor.js @@ -1337,7 +1337,9 @@ function ImageEditor(canvasId, args) { * @param {string} unit cm|inch * @return {ImageEditor} */ - this.crop = function (width, height, unit) { + this.crop = function (width, height, unit, removeTransparency) { + removeTransparency = typeof removeTransparency !== 'undefined' ? removeTransparency : false; + if (!width || !height) { return this; } @@ -1354,6 +1356,10 @@ function ImageEditor(canvasId, args) { _canvas.getImage().__cropped = false; } + if (removeTransparency) { + _canvas.getApertures().setTransparent(false); + } + return this; }; diff --git a/src/ImageEditor.js b/src/ImageEditor.js index 4c9de89..8ec25d4 100644 --- a/src/ImageEditor.js +++ b/src/ImageEditor.js @@ -99,7 +99,9 @@ function ImageEditor(canvasId, args) { * @param {string} unit cm|inch * @return {ImageEditor} */ - this.crop = function (width, height, unit) { + this.crop = function (width, height, unit, removeTransparency) { + removeTransparency = typeof removeTransparency !== 'undefined' ? removeTransparency : false; + if (!width || !height) { return this; } @@ -116,6 +118,10 @@ function ImageEditor(canvasId, args) { _canvas.getImage().__cropped = false; } + if (removeTransparency) { + _canvas.getApertures().setTransparent(false); + } + return this; };