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

Commit

Permalink
Release v2.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Fengyuan Chen committed Dec 2, 2015
1 parent 22a1e82 commit cbe2924
Show file tree
Hide file tree
Showing 10 changed files with 73 additions and 38 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Changelog


## 2.1.0 (Dec 2, 2015)

- Added new `restore` option


## 2.0.2 (Nov 30, 2015)

- Fixed #476: Floor the numerical parameters for `CanvasRenderingContext2D.drawImage`
Expand Down
16 changes: 12 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
dist/
├── cropper.css ( 5 KB)
├── cropper.min.css ( 4 KB)
├── cropper.js (72 KB)
├── cropper.js (73 KB)
└── cropper.min.js (25 KB)
```

Expand Down Expand Up @@ -66,8 +66,8 @@ The CDNJS provides CDN support for Cropper's CSS and JavaScript. You can find th
#### [RawGit](https://rawgit.com/)

```html
<link href="https://cdn.rawgit.com/fengyuanchen/cropper/v2.0.2/dist/cropper.min.css" rel="stylesheet">
<script src="https://cdn.rawgit.com/fengyuanchen/cropper/v2.0.2/dist/cropper.min.js"></script>
<link href="https://cdn.rawgit.com/fengyuanchen/cropper/v2.1.0/dist/cropper.min.css" rel="stylesheet">
<script src="https://cdn.rawgit.com/fengyuanchen/cropper/v2.1.0/dist/cropper.min.js"></script>
```


Expand Down Expand Up @@ -187,7 +187,15 @@ Add extra elements (containers) for previewing.
- Type: `Boolean`
- Default: `true`

Rebuild the cropper when resize the window.
Re-render the cropper when resize the window.


### restore

- Type: `Boolean`
- Default: `true`

Restore the cropped area after resize the window.


### checkCrossOrigin
Expand Down
6 changes: 3 additions & 3 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@
"jquery": ">= 1.9.1"
},
"devDependencies": {
"bootstrap": "~3.3.5",
"fontawesome": "~4.4.0",
"bootstrap": "~3.3.6",
"fontawesome": "~4.5.0",
"jquery": "~1.11.3",
"qunit": "~1.18.0"
"qunit": "~1.20.0"
}
}
10 changes: 8 additions & 2 deletions demo/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
Expand Down Expand Up @@ -252,7 +252,7 @@ <h4 class="modal-title" id="getCroppedCanvasTitle">Cropped</h4>
<div class="modal-body"></div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<a class="btn btn-primary" id="download" download="cropped.png" href="javascript:void(0);">Download</a>
<a class="btn btn-primary" id="download" href="javascript:void(0);" download="cropped.png">Download</a>
</div>
</div>
</div>
Expand Down Expand Up @@ -391,6 +391,12 @@ <h4 class="modal-title" id="getCroppedCanvasTitle">Cropped</h4>
responsive
</label>
</li>
<li role="presentation">
<label class="checkbox-inline">
<input type="checkbox" name="restore" checked>
restore
</label>
</li>
<li role="presentation">
<label class="checkbox-inline">
<input type="checkbox" name="checkCrossOrigin" checked>
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 v2.0.2
* Cropper v2.1.0
* https://github.com/fengyuanchen/cropper
*
* Copyright (c) 2014-2015 Fengyuan Chen and contributors
* Released under the MIT license
*
* Date: 2015-11-30T02:58:08.048Z
* Date: 2015-12-02T07:17:33.403Z
*/
.cropper-container {
position: relative;
Expand Down
33 changes: 21 additions & 12 deletions dist/cropper.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*!
* Cropper v2.0.2
* Cropper v2.1.0
* https://github.com/fengyuanchen/cropper
*
* Copyright (c) 2014-2015 Fengyuan Chen and contributors
* Released under the MIT license
*
* Date: 2015-11-30T02:58:10.111Z
* Date: 2015-12-02T07:17:35.448Z
*/

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

// Prototype
var prototype = {
version: '2.0.2'
version: '2.1.0'
};

function isNumber(n) {
Expand Down Expand Up @@ -1174,6 +1174,7 @@

$.extend(prototype, {
resize: function () {
var restore = this.options.restore;
var $container = this.$container;
var container = this.container;
var canvasData;
Expand All @@ -1189,16 +1190,21 @@

// Resize when width changed or height changed
if (ratio !== 1 || $container.height() !== container.height) {
canvasData = this.getCanvasData();
cropBoxData = this.getCropBoxData();
if (restore) {
canvasData = this.getCanvasData();
cropBoxData = this.getCropBoxData();
}

this.render();
this.setCanvasData($.each(canvasData, function (i, n) {
canvasData[i] = n * ratio;
}));
this.setCropBoxData($.each(cropBoxData, function (i, n) {
cropBoxData[i] = n * ratio;
}));

if (restore) {
this.setCanvasData($.each(canvasData, function (i, n) {
canvasData[i] = n * ratio;
}));
this.setCropBoxData($.each(cropBoxData, function (i, n) {
cropBoxData[i] = n * ratio;
}));
}
}
},

Expand Down Expand Up @@ -2537,9 +2543,12 @@
// A jQuery selector for adding extra containers to preview
preview: '',

// Rebuild when resize the window
// Re-render the cropper when resize the window
responsive: true,

// Restore the cropped area after resize the window
restore: true,

// Check if the target image is cross origin
checkCrossOrigin: true,

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.

20 changes: 13 additions & 7 deletions docs/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
Expand All @@ -11,8 +11,8 @@
<link rel="apple-touch-icon" href="apple-touch-icon.png">
<link rel="shortcut icon" href="favicon.ico">
<link rel="icon" href="favicon.ico">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<link rel="stylesheet" href="css/cropper.min.css">
<link rel="stylesheet" href="css/main.css">

Expand All @@ -37,7 +37,7 @@
</div>
<nav class="collapse navbar-collapse" id="navbar-collapse-1" role="navigation">
<ul class="nav navbar-nav navbar-right">
<li><a href="https://github.com/fengyuanchen/cropper/tree/v2.0.2/README.md">Docs</a></li>
<li><a href="https://github.com/fengyuanchen/cropper/tree/v2.1.0/README.md">Docs</a></li>
<li><a href="https://github.com/fengyuanchen/cropper">Github</a></li>
<li><a href="http://chenfengyuan.com">About</a></li>
<li><a href="http://fengyuanchen.github.io/">More</a></li>
Expand All @@ -49,7 +49,7 @@
<!-- Jumbotron -->
<div class="jumbotron docs-jumbotron">
<div class="container">
<h1>Cropper <small class="version">v2.0.2</small></h1>
<h1>Cropper <small class="version">v2.1.0</small></h1>
<p class="lead">A simple jQuery image cropping plugin.</p>
<div class="docs-carbonads-container">
<div class="docs-carbonads">
Expand Down Expand Up @@ -267,7 +267,7 @@ <h4 class="modal-title" id="getCroppedCanvasTitle">Cropped</h4>
<div class="modal-body"></div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<a class="btn btn-primary" id="download" download="cropped.png" href="javascript:void(0);">Download</a>
<a class="btn btn-primary" id="download" href="javascript:void(0);" download="cropped.png">Download</a>
</div>
</div>
</div>
Expand Down Expand Up @@ -405,6 +405,12 @@ <h4 class="modal-title" id="getCroppedCanvasTitle">Cropped</h4>
responsive
</label>
</li>
<li role="presentation">
<label class="checkbox-inline">
<input type="checkbox" name="restore" checked>
restore
</label>
</li>
<li role="presentation">
<label class="checkbox-inline">
<input type="checkbox" name="checkCrossOrigin" checked>
Expand Down Expand Up @@ -529,7 +535,7 @@ <h4 class="modal-title" id="getCroppedCanvasTitle">Cropped</h4>

<!-- Scripts -->
<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<script src="http://fengyuanchen.github.io/js/main.js"></script>
<script src="js/cropper.min.js"></script>
<script src="js/main.js"></script>
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "cropper",
"description": "A simple jQuery image cropping plugin.",
"version": "2.0.2",
"version": "2.1.0",
"main": "dist/cropper.js",
"license": "MIT",
"repository": "fengyuanchen/cropper",
"author": {
"name": "Fengyuan Chen",
"url": "chenfengyuan.com"
"url": "http://chenfengyuan.com"
},
"keywords": [
"image",
Expand All @@ -20,6 +20,7 @@
"scale",
"jquery",
"plugin",
"jqueryplugin",
"html",
"css",
"javascript",
Expand Down Expand Up @@ -49,7 +50,7 @@
"gulp-jscs": "^3.0.2",
"gulp-jshint": "^1.12.0",
"gulp-load-plugins": "^1.0.0",
"gulp-minify-css": "^1.2.1",
"gulp-minify-css": "^1.2.2",
"gulp-qunit": "^1.3.0",
"gulp-rename": "^1.2.2",
"gulp-replace": "^0.5.4",
Expand Down

0 comments on commit cbe2924

Please sign in to comment.