P5-2705 - public crop function can now remove aperture transparency

This commit is contained in:
Anders Gustafsson
2018-06-07 15:15:41 +02:00
parent d8278f8943
commit 38f4a10ed1
2 changed files with 14 additions and 2 deletions
+7 -1
View File
@@ -1337,7 +1337,9 @@ function ImageEditor(canvasId, args) {
* @param {string} unit cm|inch * @param {string} unit cm|inch
* @return {ImageEditor} * @return {ImageEditor}
*/ */
this.crop = function (width, height, unit) { this.crop = function (width, height, unit, removeTransparency) {
removeTransparency = typeof removeTransparency !== 'undefined' ? removeTransparency : false;
if (!width || !height) { if (!width || !height) {
return this; return this;
} }
@@ -1354,6 +1356,10 @@ function ImageEditor(canvasId, args) {
_canvas.getImage().__cropped = false; _canvas.getImage().__cropped = false;
} }
if (removeTransparency) {
_canvas.getApertures().setTransparent(false);
}
return this; return this;
}; };
+7 -1
View File
@@ -99,7 +99,9 @@ function ImageEditor(canvasId, args) {
* @param {string} unit cm|inch * @param {string} unit cm|inch
* @return {ImageEditor} * @return {ImageEditor}
*/ */
this.crop = function (width, height, unit) { this.crop = function (width, height, unit, removeTransparency) {
removeTransparency = typeof removeTransparency !== 'undefined' ? removeTransparency : false;
if (!width || !height) { if (!width || !height) {
return this; return this;
} }
@@ -116,6 +118,10 @@ function ImageEditor(canvasId, args) {
_canvas.getImage().__cropped = false; _canvas.getImage().__cropped = false;
} }
if (removeTransparency) {
_canvas.getApertures().setTransparent(false);
}
return this; return this;
}; };