Skip to content

Commit

Permalink
Release v0.7.2
Browse files Browse the repository at this point in the history
  • Loading branch information
fengyuanchen committed Jun 8, 2016
1 parent d0f185c commit 59076d7
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 28 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Changelog


## 0.7.2 (Jun 8, 2016)

- Fixed a bug of `data-*` attributes setting and getting.
- Fixed the calling order of `scale` and `rotate`.


## 0.7.1 (May 28, 2016)

- Improved the rotate and scale transform behaviour.
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 v0.7.1
* Cropper.js v0.7.2
* https://github.com/fengyuanchen/cropperjs
*
* Copyright (c) 2015-2016 Fengyuan Chen
* Released under the MIT license
*
* Date: 2016-05-28T14:59:00.132Z
* Date: 2016-06-08T12:25:05.932Z
*/
.cropper-container {
font-size: 0;
Expand Down
43 changes: 25 additions & 18 deletions dist/cropper.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*!
* Cropper.js v0.7.1
* Cropper.js v0.7.2
* https://github.com/fengyuanchen/cropperjs
*
* Copyright (c) 2015-2016 Fengyuan Chen
* Released under the MIT license
*
* Date: 2016-05-28T14:59:00.132Z
* Date: 2016-06-08T12:25:05.932Z
*/

(function (global, factory) {
Expand Down Expand Up @@ -74,6 +74,7 @@
var REGEXP_DATA_URL = /^data\:/;
var REGEXP_DATA_URL_HEAD = /^data\:([^\;]+)\;base64,/;
var REGEXP_DATA_URL_JPEG = /^data\:image\/jpeg.*;base64,/;
var REGEXP_HYPHENATE = /([a-z\d])([A-Z])/g;

// Data
var DATA_PREVIEW = 'preview';
Expand All @@ -96,7 +97,7 @@

// Supports
var SUPPORT_CANVAS = !!document.createElement('canvas').getContext;
var IS_SAFARI = navigator && /safari/i.test(navigator.userAgent) && /apple computer/i.test(navigator.vendor);
var IS_SAFARI_OR_UIWEBVIEW = navigator && /(Macintosh|iPhone|iPod|iPad).*AppleWebKit/i.test(navigator.userAgent);

// Maths
var min = Math.min;
Expand Down Expand Up @@ -302,21 +303,27 @@
}
}

function hyphenate(str) {
return str.replace(REGEXP_HYPHENATE, '$1-$2').toLowerCase();
}

function getData(element, name) {
return isObject(element[name]) ?
element[name] :
element.dataset ?
element.dataset[name] :
element.getAttribute('data-' + name);
if (isObject(element[name])) {
return element[name];
} else if (element.dataset) {
return element.dataset[name];
}

return element.getAttribute('data-' + hyphenate(name));
}

function setData(element, name, data) {
if (isObject(data) && isUndefined(element[name])) {
if (isObject(data)) {
element[name] = data;
} else if (element.dataset) {
element.dataset[name] = data;
} else {
element.setAttribute('data-' + name, data);
element.setAttribute('data-' + hyphenate(name), data);
}
}

Expand All @@ -326,7 +333,7 @@
} else if (element.dataset) {
delete element.dataset[name];
} else {
element.removeAttribute('data-' + name);
element.removeAttribute('data-' + hyphenate(name));
}
}

Expand Down Expand Up @@ -517,7 +524,7 @@
var newImage;

// Modern browsers (ignore Safari)
if (image.naturalWidth && !IS_SAFARI) {
if (image.naturalWidth && !IS_SAFARI_OR_UIWEBVIEW) {
return callback(image.naturalWidth, image.naturalHeight);
}

Expand Down Expand Up @@ -622,15 +629,15 @@
context.translate(translateX, translateY);
}

if (rotatable) {
context.rotate(rotate * PI / 180);
}

// Should call `scale` after rotated
// Scale should come first before rotate as in the "getTransform" function
if (scalable) {
context.scale(scaleX, scaleY);
}

if (rotatable) {
context.rotate(rotate * PI / 180);
}

context.drawImage(image, floor(dstX), floor(dstY), floor(dstWidth), floor(dstHeight));

if (advanced) {
Expand Down Expand Up @@ -714,7 +721,7 @@
orientation = dataView.getUint16(offset, littleEndian);

// Override the orientation with its default value for Safari
if (IS_SAFARI) {
if (IS_SAFARI_OR_UIWEBVIEW) {
dataView.setUint16(offset, 1, littleEndian);
}

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/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
</div>
<nav class="collapse navbar-collapse" id="navbar-collapse" role="navigation">
<ul class="nav navbar-nav navbar-right">
<li><a href="https://github.com/fengyuanchen/cropperjs/tree/v0.7.1/README.md">Docs</a></li>
<li><a href="https://github.com/fengyuanchen/cropperjs/blob/master/README.md">Docs</a></li>
<li><a href="https://fengyuanchen.github.io/photo-editor" title="An advanced example of Cropper.js">Photo Editor</a></li>
<li><a href="https://github.com/fengyuanchen/cropperjs">GitHub</a></li>
<li><a href="https://fengyuanchen.github.io">More</a></li>
Expand All @@ -45,7 +45,7 @@
<!-- Jumbotron -->
<div class="jumbotron docs-jumbotron">
<div class="container">
<h1>Cropper.js <small class="version">v0.7.1</small></h1>
<h1>Cropper.js <small class="version">v0.7.2</small></h1>
<p class="lead">JavaScript image cropper.</p>
<div class="docs-carbonads-container">
<div class="docs-carbonads">
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "cropperjs",
"description": "JavaScript image cropper.",
"version": "0.7.1",
"version": "0.7.2",
"main": "dist/cropper.js",
"license": "MIT",
"repository": "fengyuanchen/cropperjs",
Expand Down

0 comments on commit 59076d7

Please sign in to comment.