Skip to content

Commit

Permalink
build: release 1.3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
fengyuanchen committed Mar 31, 2018
1 parent 88ec7a5 commit bc201ff
Show file tree
Hide file tree
Showing 12 changed files with 140 additions and 86 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 1.3.4 (Mar 31, 2018)

- Compute destination sizes with image's aspect ratio when draw image (#326)

## 1.3.3 (Mar 18, 2018)

- Improve event binding.
Expand Down
27 changes: 19 additions & 8 deletions dist/cropper.common.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*!
* Cropper.js v1.3.3
* Cropper.js v1.3.4
* https://github.com/fengyuanchen/cropperjs
*
* Copyright (c) 2015-2018 Chen Fengyuan
* Released under the MIT license
*
* Date: 2018-03-18T03:19:54.147Z
* Date: 2018-03-31T06:49:16.394Z
*/

'use strict';
Expand Down Expand Up @@ -326,7 +326,7 @@ var REGEXP_DECIMALS = /\.\d*(?:0|9){12}\d*$/i;

/**
* Normalize decimal number.
* Check out {@link http://0.30000000000000004.com/ }
* Check out {@link http://0.30000000000000004.com/}
* @param {number} value - The value to normalize.
* @param {number} [times=100000000000] - The times for normalizing.
* @returns {number} Returns the normalized number.
Expand Down Expand Up @@ -903,7 +903,8 @@ function getRotatedSizes(_ref5) {
* @returns {HTMLCanvasElement} The result canvas.
*/
function getSourceCanvas(image, _ref6, _ref7, _ref8) {
var imageNaturalWidth = _ref6.naturalWidth,
var imageAspectRatio = _ref6.aspectRatio,
imageNaturalWidth = _ref6.naturalWidth,
imageNaturalHeight = _ref6.naturalHeight,
_ref6$rotate = _ref6.rotate,
rotate = _ref6$rotate === undefined ? 0 : _ref6$rotate,
Expand Down Expand Up @@ -946,8 +947,18 @@ function getSourceCanvas(image, _ref6, _ref7, _ref8) {

// Note: should always use image's natural sizes for drawing as
// imageData.naturalWidth === canvasData.naturalHeight when rotate % 180 === 90
var destWidth = Math.min(maxSizes.width, Math.max(minSizes.width, imageNaturalWidth));
var destHeight = Math.min(maxSizes.height, Math.max(minSizes.height, imageNaturalHeight));
var destMaxSizes = getAdjustedSizes({
aspectRatio: imageAspectRatio,
width: maxWidth,
height: maxHeight
});
var destMinSizes = getAdjustedSizes({
aspectRatio: imageAspectRatio,
width: minWidth,
height: minHeight
}, 'cover');
var destWidth = Math.min(destMaxSizes.width, Math.max(destMinSizes.width, imageNaturalWidth));
var destHeight = Math.min(destMaxSizes.height, Math.max(destMinSizes.height, imageNaturalHeight));
var params = [-destWidth / 2, -destHeight / 2, destWidth, destHeight];

canvas.width = normalizeDecimalNumber(width);
Expand Down Expand Up @@ -3161,8 +3172,6 @@ var methods = {
dstHeight = srcHeight;
}

// All the numerical parameters should be integer for `drawImage`
// https://github.com/fengyuanchen/cropper/issues/476
var params = [srcX, srcY, srcWidth, srcHeight];

// Avoid "IndexSizeError"
Expand All @@ -3172,6 +3181,8 @@ var methods = {
params.push(dstX * scale, dstY * scale, dstWidth * scale, dstHeight * scale);
}

// All the numerical parameters should be integer for `drawImage`
// https://github.com/fengyuanchen/cropper/issues/476
context.drawImage.apply(context, [source].concat(toConsumableArray(params.map(function (param) {
return Math.floor(normalizeDecimalNumber(param));
}))));
Expand Down
4 changes: 2 additions & 2 deletions dist/cropper.css
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*!
* Cropper.js v1.3.3
* Cropper.js v1.3.4
* https://github.com/fengyuanchen/cropperjs
*
* Copyright (c) 2015-2018 Chen Fengyuan
* Released under the MIT license
*
* Date: 2018-03-18T03:19:07.619Z
* Date: 2018-03-31T06:49:06.196Z
*/

.cropper-container {
Expand Down
27 changes: 19 additions & 8 deletions dist/cropper.esm.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*!
* Cropper.js v1.3.3
* Cropper.js v1.3.4
* https://github.com/fengyuanchen/cropperjs
*
* Copyright (c) 2015-2018 Chen Fengyuan
* Released under the MIT license
*
* Date: 2018-03-18T03:19:54.147Z
* Date: 2018-03-31T06:49:16.394Z
*/

var IN_BROWSER = typeof window !== 'undefined';
Expand Down Expand Up @@ -324,7 +324,7 @@ var REGEXP_DECIMALS = /\.\d*(?:0|9){12}\d*$/i;

/**
* Normalize decimal number.
* Check out {@link http://0.30000000000000004.com/ }
* Check out {@link http://0.30000000000000004.com/}
* @param {number} value - The value to normalize.
* @param {number} [times=100000000000] - The times for normalizing.
* @returns {number} Returns the normalized number.
Expand Down Expand Up @@ -901,7 +901,8 @@ function getRotatedSizes(_ref5) {
* @returns {HTMLCanvasElement} The result canvas.
*/
function getSourceCanvas(image, _ref6, _ref7, _ref8) {
var imageNaturalWidth = _ref6.naturalWidth,
var imageAspectRatio = _ref6.aspectRatio,
imageNaturalWidth = _ref6.naturalWidth,
imageNaturalHeight = _ref6.naturalHeight,
_ref6$rotate = _ref6.rotate,
rotate = _ref6$rotate === undefined ? 0 : _ref6$rotate,
Expand Down Expand Up @@ -944,8 +945,18 @@ function getSourceCanvas(image, _ref6, _ref7, _ref8) {

// Note: should always use image's natural sizes for drawing as
// imageData.naturalWidth === canvasData.naturalHeight when rotate % 180 === 90
var destWidth = Math.min(maxSizes.width, Math.max(minSizes.width, imageNaturalWidth));
var destHeight = Math.min(maxSizes.height, Math.max(minSizes.height, imageNaturalHeight));
var destMaxSizes = getAdjustedSizes({
aspectRatio: imageAspectRatio,
width: maxWidth,
height: maxHeight
});
var destMinSizes = getAdjustedSizes({
aspectRatio: imageAspectRatio,
width: minWidth,
height: minHeight
}, 'cover');
var destWidth = Math.min(destMaxSizes.width, Math.max(destMinSizes.width, imageNaturalWidth));
var destHeight = Math.min(destMaxSizes.height, Math.max(destMinSizes.height, imageNaturalHeight));
var params = [-destWidth / 2, -destHeight / 2, destWidth, destHeight];

canvas.width = normalizeDecimalNumber(width);
Expand Down Expand Up @@ -3159,8 +3170,6 @@ var methods = {
dstHeight = srcHeight;
}

// All the numerical parameters should be integer for `drawImage`
// https://github.com/fengyuanchen/cropper/issues/476
var params = [srcX, srcY, srcWidth, srcHeight];

// Avoid "IndexSizeError"
Expand All @@ -3170,6 +3179,8 @@ var methods = {
params.push(dstX * scale, dstY * scale, dstWidth * scale, dstHeight * scale);
}

// All the numerical parameters should be integer for `drawImage`
// https://github.com/fengyuanchen/cropper/issues/476
context.drawImage.apply(context, [source].concat(toConsumableArray(params.map(function (param) {
return Math.floor(normalizeDecimalNumber(param));
}))));
Expand Down
27 changes: 19 additions & 8 deletions dist/cropper.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*!
* Cropper.js v1.3.3
* Cropper.js v1.3.4
* https://github.com/fengyuanchen/cropperjs
*
* Copyright (c) 2015-2018 Chen Fengyuan
* Released under the MIT license
*
* Date: 2018-03-18T03:19:54.147Z
* Date: 2018-03-31T06:49:16.394Z
*/

(function (global, factory) {
Expand Down Expand Up @@ -330,7 +330,7 @@

/**
* Normalize decimal number.
* Check out {@link http://0.30000000000000004.com/ }
* Check out {@link http://0.30000000000000004.com/}
* @param {number} value - The value to normalize.
* @param {number} [times=100000000000] - The times for normalizing.
* @returns {number} Returns the normalized number.
Expand Down Expand Up @@ -907,7 +907,8 @@
* @returns {HTMLCanvasElement} The result canvas.
*/
function getSourceCanvas(image, _ref6, _ref7, _ref8) {
var imageNaturalWidth = _ref6.naturalWidth,
var imageAspectRatio = _ref6.aspectRatio,
imageNaturalWidth = _ref6.naturalWidth,
imageNaturalHeight = _ref6.naturalHeight,
_ref6$rotate = _ref6.rotate,
rotate = _ref6$rotate === undefined ? 0 : _ref6$rotate,
Expand Down Expand Up @@ -950,8 +951,18 @@

// Note: should always use image's natural sizes for drawing as
// imageData.naturalWidth === canvasData.naturalHeight when rotate % 180 === 90
var destWidth = Math.min(maxSizes.width, Math.max(minSizes.width, imageNaturalWidth));
var destHeight = Math.min(maxSizes.height, Math.max(minSizes.height, imageNaturalHeight));
var destMaxSizes = getAdjustedSizes({
aspectRatio: imageAspectRatio,
width: maxWidth,
height: maxHeight
});
var destMinSizes = getAdjustedSizes({
aspectRatio: imageAspectRatio,
width: minWidth,
height: minHeight
}, 'cover');
var destWidth = Math.min(destMaxSizes.width, Math.max(destMinSizes.width, imageNaturalWidth));
var destHeight = Math.min(destMaxSizes.height, Math.max(destMinSizes.height, imageNaturalHeight));
var params = [-destWidth / 2, -destHeight / 2, destWidth, destHeight];

canvas.width = normalizeDecimalNumber(width);
Expand Down Expand Up @@ -3165,8 +3176,6 @@
dstHeight = srcHeight;
}

// All the numerical parameters should be integer for `drawImage`
// https://github.com/fengyuanchen/cropper/issues/476
var params = [srcX, srcY, srcWidth, srcHeight];

// Avoid "IndexSizeError"
Expand All @@ -3176,6 +3185,8 @@
params.push(dstX * scale, dstY * scale, dstWidth * scale, dstHeight * scale);
}

// All the numerical parameters should be integer for `drawImage`
// https://github.com/fengyuanchen/cropper/issues/476
context.drawImage.apply(context, [source].concat(toConsumableArray(params.map(function (param) {
return Math.floor(normalizeDecimalNumber(param));
}))));
Expand Down
4 changes: 2 additions & 2 deletions dist/cropper.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions dist/cropper.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/css/cropper.css
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*!
* Cropper.js v1.3.3
* Cropper.js v1.3.4
* https://github.com/fengyuanchen/cropperjs
*
* Copyright (c) 2015-2018 Chen Fengyuan
* Released under the MIT license
*
* Date: 2018-03-18T03:19:07.619Z
* Date: 2018-03-31T06:49:06.196Z
*/

.cropper-container {
Expand Down
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<div class="container">
<div class="row">
<div class="col-md">
<h1>Cropper.js <small class="h6">v1.3.3</small></h1>
<h1>Cropper.js <small class="h6">v1.3.4</small></h1>
<p class="lead">JavaScript image cropper.</p>
</div>
<div class="col-md">
Expand Down
27 changes: 19 additions & 8 deletions docs/js/cropper.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*!
* Cropper.js v1.3.3
* Cropper.js v1.3.4
* https://github.com/fengyuanchen/cropperjs
*
* Copyright (c) 2015-2018 Chen Fengyuan
* Released under the MIT license
*
* Date: 2018-03-18T03:19:54.147Z
* Date: 2018-03-31T06:49:16.394Z
*/

(function (global, factory) {
Expand Down Expand Up @@ -330,7 +330,7 @@

/**
* Normalize decimal number.
* Check out {@link http://0.30000000000000004.com/ }
* Check out {@link http://0.30000000000000004.com/}
* @param {number} value - The value to normalize.
* @param {number} [times=100000000000] - The times for normalizing.
* @returns {number} Returns the normalized number.
Expand Down Expand Up @@ -907,7 +907,8 @@
* @returns {HTMLCanvasElement} The result canvas.
*/
function getSourceCanvas(image, _ref6, _ref7, _ref8) {
var imageNaturalWidth = _ref6.naturalWidth,
var imageAspectRatio = _ref6.aspectRatio,
imageNaturalWidth = _ref6.naturalWidth,
imageNaturalHeight = _ref6.naturalHeight,
_ref6$rotate = _ref6.rotate,
rotate = _ref6$rotate === undefined ? 0 : _ref6$rotate,
Expand Down Expand Up @@ -950,8 +951,18 @@

// Note: should always use image's natural sizes for drawing as
// imageData.naturalWidth === canvasData.naturalHeight when rotate % 180 === 90
var destWidth = Math.min(maxSizes.width, Math.max(minSizes.width, imageNaturalWidth));
var destHeight = Math.min(maxSizes.height, Math.max(minSizes.height, imageNaturalHeight));
var destMaxSizes = getAdjustedSizes({
aspectRatio: imageAspectRatio,
width: maxWidth,
height: maxHeight
});
var destMinSizes = getAdjustedSizes({
aspectRatio: imageAspectRatio,
width: minWidth,
height: minHeight
}, 'cover');
var destWidth = Math.min(destMaxSizes.width, Math.max(destMinSizes.width, imageNaturalWidth));
var destHeight = Math.min(destMaxSizes.height, Math.max(destMinSizes.height, imageNaturalHeight));
var params = [-destWidth / 2, -destHeight / 2, destWidth, destHeight];

canvas.width = normalizeDecimalNumber(width);
Expand Down Expand Up @@ -3165,8 +3176,6 @@
dstHeight = srcHeight;
}

// All the numerical parameters should be integer for `drawImage`
// https://github.com/fengyuanchen/cropper/issues/476
var params = [srcX, srcY, srcWidth, srcHeight];

// Avoid "IndexSizeError"
Expand All @@ -3176,6 +3185,8 @@
params.push(dstX * scale, dstY * scale, dstWidth * scale, dstHeight * scale);
}

// All the numerical parameters should be integer for `drawImage`
// https://github.com/fengyuanchen/cropper/issues/476
context.drawImage.apply(context, [source].concat(toConsumableArray(params.map(function (param) {
return Math.floor(normalizeDecimalNumber(param));
}))));
Expand Down
Loading

0 comments on commit bc201ff

Please sign in to comment.