Skip to content

Commit

Permalink
build: release 1.1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
fengyuanchen committed Oct 21, 2017
1 parent bdbc456 commit f6aff44
Show file tree
Hide file tree
Showing 14 changed files with 203 additions and 161 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.1.3 (Oct 21, 2017)

- Fixed a bug of render when disable one of `rotatable` and `scalable` options (#241).

## 1.1.2 (Oct 18, 2017)

- Normalize related decimal numbers when crop an image with canvas.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,7 @@ Get a canvas drawn the cropped image. If it is not cropped, then returns a canva

> After then, you can display the canvas as an image directly, or use [HTMLCanvasElement.toDataURL](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toDataURL) to get a Data URL, or use [HTMLCanvasElement.toBlob](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob) to get a blob and upload it to server with [FormData](https://developer.mozilla.org/en-US/docs/Web/API/FormData) if the browser supports these APIs.
Avoid to get a blank output image, you might need to set the `maxWidth` and `maxHeight`properties to limited numbers, because of [the size limits of a canvas element](https://stackoverflow.com/questions/6081483/maximum-size-of-a-canvas-element).
Avoid to get a blank output image, you might need to set the `maxWidth` and `maxHeight` properties to limited numbers, because of [the size limits of a canvas element](https://stackoverflow.com/questions/6081483/maximum-size-of-a-canvas-element).

```js
cropper.getCroppedCanvas();
Expand Down
54 changes: 28 additions & 26 deletions dist/cropper.common.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
/*!
* Cropper.js v1.1.2
* Cropper.js v1.1.3
* https://github.com/fengyuanchen/cropperjs
*
* Copyright (c) 2015-2017 Chen Fengyuan
* Released under the MIT license
*
* Date: 2017-10-18T13:27:02.189Z
* Date: 2017-10-21T09:27:36.848Z
*/

'use strict';

var global = typeof window !== 'undefined' ? window : {};

var WINDOW = typeof window !== 'undefined' ? window : {};
var NAMESPACE = 'cropper';

// Actions
Expand Down Expand Up @@ -54,9 +53,9 @@ var EVENT_CROP_START = 'cropstart';
var EVENT_DBLCLICK = 'dblclick';
var EVENT_ERROR = 'error';
var EVENT_LOAD = 'load';
var EVENT_POINTER_DOWN = global.PointerEvent ? 'pointerdown' : 'touchstart mousedown';
var EVENT_POINTER_MOVE = global.PointerEvent ? 'pointermove' : 'touchmove mousemove';
var EVENT_POINTER_UP = global.PointerEvent ? ' pointerup pointercancel' : 'touchend touchcancel mouseup';
var EVENT_POINTER_DOWN = WINDOW.PointerEvent ? 'pointerdown' : 'touchstart mousedown';
var EVENT_POINTER_MOVE = WINDOW.PointerEvent ? 'pointermove' : 'touchmove mousemove';
var EVENT_POINTER_UP = WINDOW.PointerEvent ? ' pointerup pointercancel' : 'touchend touchcancel mouseup';
var EVENT_READY = 'ready';
var EVENT_RESIZE = 'resize';
var EVENT_WHEEL = 'wheel mousewheel DOMMouseScroll';
Expand Down Expand Up @@ -173,7 +172,7 @@ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr
/**
* Check if the given value is not a number.
*/
var isNaN = Number.isNaN || global.isNaN;
var isNaN = Number.isNaN || WINDOW.isNaN;

/**
* Check if the given value is a number.
Expand Down Expand Up @@ -637,8 +636,8 @@ function getOffset(element) {
var box = element.getBoundingClientRect();

return {
left: box.left + ((global.scrollX || doc && doc.scrollLeft || 0) - (doc && doc.clientLeft || 0)),
top: box.top + ((global.scrollY || doc && doc.scrollTop || 0) - (doc && doc.clientTop || 0))
left: box.left + ((window.scrollX || doc && doc.scrollLeft || 0) - (doc && doc.clientLeft || 0)),
top: box.top + ((window.scrollY || doc && doc.scrollTop || 0) - (doc && doc.clientTop || 0))
};
}

Expand All @@ -652,7 +651,7 @@ function empty(element) {
}
}

var location = global.location;
var location = WINDOW.location;

var REGEXP_ORIGINS = /^(https?:)\/\/([^:/?#]+):?(\d*)/i;

Expand Down Expand Up @@ -722,7 +721,7 @@ function getTransforms(_ref) {
};
}

var navigator = global.navigator;
var navigator = WINDOW.navigator;

var IS_SAFARI_OR_UIWEBVIEW = navigator && /(Macintosh|iPhone|iPod|iPad).*AppleWebKit/i.test(navigator.userAgent);

Expand Down Expand Up @@ -835,7 +834,7 @@ function getPointersCenter(pointers) {
/**
* Check if the given value is a finite number.
*/
var isFinite = Number.isFinite || global.isFinite;
var isFinite = Number.isFinite || WINDOW.isFinite;

/**
* Get the max sizes in a rectangle under the given aspect ratio.
Expand Down Expand Up @@ -909,9 +908,12 @@ function getRotatedSizes(_ref5) {
function getSourceCanvas(image, _ref6, _ref7, _ref8) {
var imageNaturalWidth = _ref6.naturalWidth,
imageNaturalHeight = _ref6.naturalHeight,
rotate = _ref6.rotate,
scaleX = _ref6.scaleX,
scaleY = _ref6.scaleY;
_ref6$rotate = _ref6.rotate,
rotate = _ref6$rotate === undefined ? 0 : _ref6$rotate,
_ref6$scaleX = _ref6.scaleX,
scaleX = _ref6$scaleX === undefined ? 1 : _ref6$scaleX,
_ref6$scaleY = _ref6.scaleY,
scaleY = _ref6$scaleY === undefined ? 1 : _ref6$scaleY;
var aspectRatio = _ref7.aspectRatio,
naturalWidth = _ref7.naturalWidth,
naturalHeight = _ref7.naturalHeight;
Expand Down Expand Up @@ -1338,9 +1340,9 @@ var render = {

if (transformed) {
var _getRotatedSizes = getRotatedSizes({
width: imageData.naturalWidth * Math.abs(imageData.scaleX),
height: imageData.naturalHeight * Math.abs(imageData.scaleY),
degree: imageData.rotate
width: imageData.naturalWidth * Math.abs(imageData.scaleX || 1),
height: imageData.naturalHeight * Math.abs(imageData.scaleY || 1),
degree: imageData.rotate || 0
}),
naturalWidth = _getRotatedSizes.width,
naturalHeight = _getRotatedSizes.height;
Expand Down Expand Up @@ -1730,7 +1732,7 @@ var events = {
addListener(document, EVENT_POINTER_UP, this.onCropEnd = proxy(this.cropEnd, this));

if (options.responsive) {
addListener(global, EVENT_RESIZE, this.onResize = proxy(this.resize, this));
addListener(window, EVENT_RESIZE, this.onResize = proxy(this.resize, this));
}
},
unbind: function unbind() {
Expand Down Expand Up @@ -1773,7 +1775,7 @@ var events = {
removeListener(document, EVENT_POINTER_UP, this.onCropEnd);

if (options.responsive) {
removeListener(global, EVENT_RESIZE, this.onResize);
removeListener(window, EVENT_RESIZE, this.onResize);
}
}
};
Expand Down Expand Up @@ -3049,7 +3051,7 @@ var methods = {
getCroppedCanvas: function getCroppedCanvas() {
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

if (!this.ready || !global.HTMLCanvasElement) {
if (!this.ready || !window.HTMLCanvasElement) {
return null;
}

Expand Down Expand Up @@ -3241,7 +3243,7 @@ var _createClass = function () { function defineProperties(target, props) { for

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

var AnotherCropper = global.Cropper;
var AnotherCropper = WINDOW.Cropper;

var Cropper = function () {
/**
Expand Down Expand Up @@ -3305,7 +3307,7 @@ var Cropper = function () {

// e.g.: "http://example.com/img/picture.jpg"
url = element.src;
} else if (tagName === 'canvas' && global.HTMLCanvasElement) {
} else if (tagName === 'canvas' && window.HTMLCanvasElement) {
url = element.toDataURL();
}

Expand All @@ -3327,7 +3329,7 @@ var Cropper = function () {
options = this.options;


if (!options.checkOrientation || !global.ArrayBuffer) {
if (!options.checkOrientation || !window.ArrayBuffer) {
this.clone();
return;
}
Expand Down Expand Up @@ -3637,7 +3639,7 @@ var Cropper = function () {
}], [{
key: 'noConflict',
value: function noConflict() {
global.Cropper = AnotherCropper;
window.Cropper = AnotherCropper;
return Cropper;
}

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.1.2
* Cropper.js v1.1.3
* https://github.com/fengyuanchen/cropperjs
*
* Copyright (c) 2015-2017 Chen Fengyuan
* Released under the MIT license
*
* Date: 2017-10-18T13:26:08.981Z
* Date: 2017-10-21T09:27:29.883Z
*/

.cropper-container {
Expand Down
54 changes: 28 additions & 26 deletions dist/cropper.esm.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
/*!
* Cropper.js v1.1.2
* Cropper.js v1.1.3
* https://github.com/fengyuanchen/cropperjs
*
* Copyright (c) 2015-2017 Chen Fengyuan
* Released under the MIT license
*
* Date: 2017-10-18T13:27:02.189Z
* Date: 2017-10-21T09:27:36.848Z
*/

var global = typeof window !== 'undefined' ? window : {};

var WINDOW = typeof window !== 'undefined' ? window : {};
var NAMESPACE = 'cropper';

// Actions
Expand Down Expand Up @@ -52,9 +51,9 @@ var EVENT_CROP_START = 'cropstart';
var EVENT_DBLCLICK = 'dblclick';
var EVENT_ERROR = 'error';
var EVENT_LOAD = 'load';
var EVENT_POINTER_DOWN = global.PointerEvent ? 'pointerdown' : 'touchstart mousedown';
var EVENT_POINTER_MOVE = global.PointerEvent ? 'pointermove' : 'touchmove mousemove';
var EVENT_POINTER_UP = global.PointerEvent ? ' pointerup pointercancel' : 'touchend touchcancel mouseup';
var EVENT_POINTER_DOWN = WINDOW.PointerEvent ? 'pointerdown' : 'touchstart mousedown';
var EVENT_POINTER_MOVE = WINDOW.PointerEvent ? 'pointermove' : 'touchmove mousemove';
var EVENT_POINTER_UP = WINDOW.PointerEvent ? ' pointerup pointercancel' : 'touchend touchcancel mouseup';
var EVENT_READY = 'ready';
var EVENT_RESIZE = 'resize';
var EVENT_WHEEL = 'wheel mousewheel DOMMouseScroll';
Expand Down Expand Up @@ -171,7 +170,7 @@ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr
/**
* Check if the given value is not a number.
*/
var isNaN = Number.isNaN || global.isNaN;
var isNaN = Number.isNaN || WINDOW.isNaN;

/**
* Check if the given value is a number.
Expand Down Expand Up @@ -635,8 +634,8 @@ function getOffset(element) {
var box = element.getBoundingClientRect();

return {
left: box.left + ((global.scrollX || doc && doc.scrollLeft || 0) - (doc && doc.clientLeft || 0)),
top: box.top + ((global.scrollY || doc && doc.scrollTop || 0) - (doc && doc.clientTop || 0))
left: box.left + ((window.scrollX || doc && doc.scrollLeft || 0) - (doc && doc.clientLeft || 0)),
top: box.top + ((window.scrollY || doc && doc.scrollTop || 0) - (doc && doc.clientTop || 0))
};
}

Expand All @@ -650,7 +649,7 @@ function empty(element) {
}
}

var location = global.location;
var location = WINDOW.location;

var REGEXP_ORIGINS = /^(https?:)\/\/([^:/?#]+):?(\d*)/i;

Expand Down Expand Up @@ -720,7 +719,7 @@ function getTransforms(_ref) {
};
}

var navigator = global.navigator;
var navigator = WINDOW.navigator;

var IS_SAFARI_OR_UIWEBVIEW = navigator && /(Macintosh|iPhone|iPod|iPad).*AppleWebKit/i.test(navigator.userAgent);

Expand Down Expand Up @@ -833,7 +832,7 @@ function getPointersCenter(pointers) {
/**
* Check if the given value is a finite number.
*/
var isFinite = Number.isFinite || global.isFinite;
var isFinite = Number.isFinite || WINDOW.isFinite;

/**
* Get the max sizes in a rectangle under the given aspect ratio.
Expand Down Expand Up @@ -907,9 +906,12 @@ function getRotatedSizes(_ref5) {
function getSourceCanvas(image, _ref6, _ref7, _ref8) {
var imageNaturalWidth = _ref6.naturalWidth,
imageNaturalHeight = _ref6.naturalHeight,
rotate = _ref6.rotate,
scaleX = _ref6.scaleX,
scaleY = _ref6.scaleY;
_ref6$rotate = _ref6.rotate,
rotate = _ref6$rotate === undefined ? 0 : _ref6$rotate,
_ref6$scaleX = _ref6.scaleX,
scaleX = _ref6$scaleX === undefined ? 1 : _ref6$scaleX,
_ref6$scaleY = _ref6.scaleY,
scaleY = _ref6$scaleY === undefined ? 1 : _ref6$scaleY;
var aspectRatio = _ref7.aspectRatio,
naturalWidth = _ref7.naturalWidth,
naturalHeight = _ref7.naturalHeight;
Expand Down Expand Up @@ -1336,9 +1338,9 @@ var render = {

if (transformed) {
var _getRotatedSizes = getRotatedSizes({
width: imageData.naturalWidth * Math.abs(imageData.scaleX),
height: imageData.naturalHeight * Math.abs(imageData.scaleY),
degree: imageData.rotate
width: imageData.naturalWidth * Math.abs(imageData.scaleX || 1),
height: imageData.naturalHeight * Math.abs(imageData.scaleY || 1),
degree: imageData.rotate || 0
}),
naturalWidth = _getRotatedSizes.width,
naturalHeight = _getRotatedSizes.height;
Expand Down Expand Up @@ -1728,7 +1730,7 @@ var events = {
addListener(document, EVENT_POINTER_UP, this.onCropEnd = proxy(this.cropEnd, this));

if (options.responsive) {
addListener(global, EVENT_RESIZE, this.onResize = proxy(this.resize, this));
addListener(window, EVENT_RESIZE, this.onResize = proxy(this.resize, this));
}
},
unbind: function unbind() {
Expand Down Expand Up @@ -1771,7 +1773,7 @@ var events = {
removeListener(document, EVENT_POINTER_UP, this.onCropEnd);

if (options.responsive) {
removeListener(global, EVENT_RESIZE, this.onResize);
removeListener(window, EVENT_RESIZE, this.onResize);
}
}
};
Expand Down Expand Up @@ -3047,7 +3049,7 @@ var methods = {
getCroppedCanvas: function getCroppedCanvas() {
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

if (!this.ready || !global.HTMLCanvasElement) {
if (!this.ready || !window.HTMLCanvasElement) {
return null;
}

Expand Down Expand Up @@ -3239,7 +3241,7 @@ var _createClass = function () { function defineProperties(target, props) { for

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

var AnotherCropper = global.Cropper;
var AnotherCropper = WINDOW.Cropper;

var Cropper = function () {
/**
Expand Down Expand Up @@ -3303,7 +3305,7 @@ var Cropper = function () {

// e.g.: "http://example.com/img/picture.jpg"
url = element.src;
} else if (tagName === 'canvas' && global.HTMLCanvasElement) {
} else if (tagName === 'canvas' && window.HTMLCanvasElement) {
url = element.toDataURL();
}

Expand All @@ -3325,7 +3327,7 @@ var Cropper = function () {
options = this.options;


if (!options.checkOrientation || !global.ArrayBuffer) {
if (!options.checkOrientation || !window.ArrayBuffer) {
this.clone();
return;
}
Expand Down Expand Up @@ -3635,7 +3637,7 @@ var Cropper = function () {
}], [{
key: 'noConflict',
value: function noConflict() {
global.Cropper = AnotherCropper;
window.Cropper = AnotherCropper;
return Cropper;
}

Expand Down
Loading

0 comments on commit f6aff44

Please sign in to comment.