Skip to content
This repository has been archived by the owner on Aug 1, 2020. It is now read-only.

Commit

Permalink
build: release 4.0.0-beta
Browse files Browse the repository at this point in the history
  • Loading branch information
fengyuanchen committed Mar 3, 2018
1 parent 8b21efc commit 850ffde
Show file tree
Hide file tree
Showing 13 changed files with 159 additions and 109 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 4.0.0-beta (Mar 3, 2018)

- Upgrade Cropper.js from 1.3.1 to 1.3.2.

## 4.0.0-alpha (Mar 1, 2018)

- The core code of Cropper is replaced with [Cropper.js](https://github.com/fengyuanchen/cropperjs) now.
Expand Down
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,11 @@ img {
```

```js
$('#image').cropper({
var $image = $('#image');

$image.cropper({
aspectRatio: 16 / 9,
crop: function(event) {
// Output the result data for cropping image.
console.log(event.detail.x);
console.log(event.detail.y);
console.log(event.detail.width);
Expand All @@ -70,12 +71,9 @@ $('#image').cropper({
console.log(event.detail.scaleY);
}
});
```

After initialize can get `Cropper` instance:

```js
$('#image').data('cropper');
// Get the Cropper.js instance after initialized
var cropper = $image.data('cropper');
```

## Options
Expand Down
15 changes: 11 additions & 4 deletions dist/cropper.common.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*!
* Cropper v4.0.0-alpha
* Cropper v4.0.0-beta
* https://github.com/fengyuanchen/cropper
*
* Copyright (c) 2014-2018 Chen Fengyuan
* Released under the MIT license
*
* Date: 2018-03-01T14:21:13.980Z
* Date: 2018-03-03T03:59:36.917Z
*/

'use strict';
Expand Down Expand Up @@ -841,7 +841,9 @@ function getRotatedSizes(_ref5) {
* @returns {HTMLCanvasElement} The result canvas.
*/
function getSourceCanvas(image, _ref6, _ref7, _ref8) {
var _ref6$rotate = _ref6.rotate,
var imageNaturalWidth = _ref6.naturalWidth,
imageNaturalHeight = _ref6.naturalHeight,
_ref6$rotate = _ref6.rotate,
rotate = _ref6$rotate === undefined ? 0 : _ref6$rotate,
_ref6$scaleX = _ref6.scaleX,
scaleX = _ref6$scaleX === undefined ? 1 : _ref6$scaleX,
Expand Down Expand Up @@ -879,7 +881,12 @@ function getSourceCanvas(image, _ref6, _ref7, _ref8) {
}, 'cover');
var width = Math.min(maxSizes.width, Math.max(minSizes.width, naturalWidth));
var height = Math.min(maxSizes.height, Math.max(minSizes.height, naturalHeight));
var params = [-width / 2, -height / 2, width, height];

// 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 params = [-destWidth / 2, -destHeight / 2, destWidth, destHeight];

canvas.width = normalizeDecimalNumber(width);
canvas.height = normalizeDecimalNumber(height);
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 v4.0.0-alpha
* Cropper v4.0.0-beta
* https://github.com/fengyuanchen/cropper
*
* Copyright (c) 2014-2018 Chen Fengyuan
* Released under the MIT license
*
* Date: 2018-03-01T14:21:03.491Z
* Date: 2018-03-03T03:58:44.059Z
*/

.cropper-container {
Expand Down
15 changes: 11 additions & 4 deletions dist/cropper.esm.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*!
* Cropper v4.0.0-alpha
* Cropper v4.0.0-beta
* https://github.com/fengyuanchen/cropper
*
* Copyright (c) 2014-2018 Chen Fengyuan
* Released under the MIT license
*
* Date: 2018-03-01T14:21:13.980Z
* Date: 2018-03-03T03:59:36.917Z
*/

import $ from 'jquery';
Expand Down Expand Up @@ -837,7 +837,9 @@ function getRotatedSizes(_ref5) {
* @returns {HTMLCanvasElement} The result canvas.
*/
function getSourceCanvas(image, _ref6, _ref7, _ref8) {
var _ref6$rotate = _ref6.rotate,
var imageNaturalWidth = _ref6.naturalWidth,
imageNaturalHeight = _ref6.naturalHeight,
_ref6$rotate = _ref6.rotate,
rotate = _ref6$rotate === undefined ? 0 : _ref6$rotate,
_ref6$scaleX = _ref6.scaleX,
scaleX = _ref6$scaleX === undefined ? 1 : _ref6$scaleX,
Expand Down Expand Up @@ -875,7 +877,12 @@ function getSourceCanvas(image, _ref6, _ref7, _ref8) {
}, 'cover');
var width = Math.min(maxSizes.width, Math.max(minSizes.width, naturalWidth));
var height = Math.min(maxSizes.height, Math.max(minSizes.height, naturalHeight));
var params = [-width / 2, -height / 2, width, height];

// 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 params = [-destWidth / 2, -destHeight / 2, destWidth, destHeight];

canvas.width = normalizeDecimalNumber(width);
canvas.height = normalizeDecimalNumber(height);
Expand Down
15 changes: 11 additions & 4 deletions dist/cropper.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*!
* Cropper v4.0.0-alpha
* Cropper v4.0.0-beta
* https://github.com/fengyuanchen/cropper
*
* Copyright (c) 2014-2018 Chen Fengyuan
* Released under the MIT license
*
* Date: 2018-03-01T14:21:13.980Z
* Date: 2018-03-03T03:59:36.917Z
*/

(function (global, factory) {
Expand Down Expand Up @@ -843,7 +843,9 @@ function getRotatedSizes(_ref5) {
* @returns {HTMLCanvasElement} The result canvas.
*/
function getSourceCanvas(image, _ref6, _ref7, _ref8) {
var _ref6$rotate = _ref6.rotate,
var imageNaturalWidth = _ref6.naturalWidth,
imageNaturalHeight = _ref6.naturalHeight,
_ref6$rotate = _ref6.rotate,
rotate = _ref6$rotate === undefined ? 0 : _ref6$rotate,
_ref6$scaleX = _ref6.scaleX,
scaleX = _ref6$scaleX === undefined ? 1 : _ref6$scaleX,
Expand Down Expand Up @@ -881,7 +883,12 @@ function getSourceCanvas(image, _ref6, _ref7, _ref8) {
}, 'cover');
var width = Math.min(maxSizes.width, Math.max(minSizes.width, naturalWidth));
var height = Math.min(maxSizes.height, Math.max(minSizes.height, naturalHeight));
var params = [-width / 2, -height / 2, width, height];

// 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 params = [-destWidth / 2, -destHeight / 2, destWidth, destHeight];

canvas.width = normalizeDecimalNumber(width);
canvas.height = normalizeDecimalNumber(height);
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 v4.0.0-alpha
* Cropper v4.0.0-beta
* https://github.com/fengyuanchen/cropper
*
* Copyright (c) 2014-2018 Chen Fengyuan
* Released under the MIT license
*
* Date: 2018-03-01T14:21:03.491Z
* Date: 2018-03-03T03:58:44.059Z
*/

.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 @@ -49,7 +49,7 @@
<div class="container">
<div class="row">
<div class="col-md">
<h1>Cropper <small class="h6">v4.0.0-alpha</small></h1>
<h1>Cropper <small class="h6">v4.0.0-beta</small></h1>
<p class="lead">A simple jQuery image cropping plugin.</p>
</div>
<div class="col-md">
Expand Down
15 changes: 11 additions & 4 deletions docs/js/cropper.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*!
* Cropper v4.0.0-alpha
* Cropper v4.0.0-beta
* https://github.com/fengyuanchen/cropper
*
* Copyright (c) 2014-2018 Chen Fengyuan
* Released under the MIT license
*
* Date: 2018-03-01T14:21:13.980Z
* Date: 2018-03-03T03:59:36.917Z
*/

(function (global, factory) {
Expand Down Expand Up @@ -843,7 +843,9 @@ function getRotatedSizes(_ref5) {
* @returns {HTMLCanvasElement} The result canvas.
*/
function getSourceCanvas(image, _ref6, _ref7, _ref8) {
var _ref6$rotate = _ref6.rotate,
var imageNaturalWidth = _ref6.naturalWidth,
imageNaturalHeight = _ref6.naturalHeight,
_ref6$rotate = _ref6.rotate,
rotate = _ref6$rotate === undefined ? 0 : _ref6$rotate,
_ref6$scaleX = _ref6.scaleX,
scaleX = _ref6$scaleX === undefined ? 1 : _ref6$scaleX,
Expand Down Expand Up @@ -881,7 +883,12 @@ function getSourceCanvas(image, _ref6, _ref7, _ref8) {
}, 'cover');
var width = Math.min(maxSizes.width, Math.max(minSizes.width, naturalWidth));
var height = Math.min(maxSizes.height, Math.max(minSizes.height, naturalHeight));
var params = [-width / 2, -height / 2, width, height];

// 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 params = [-destWidth / 2, -destHeight / 2, destWidth, destHeight];

canvas.width = normalizeDecimalNumber(width);
canvas.height = normalizeDecimalNumber(height);
Expand Down
Loading

0 comments on commit 850ffde

Please sign in to comment.