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

Commit

Permalink
Improve issue #34
Browse files Browse the repository at this point in the history
  • Loading branch information
Fengyuan Chen committed Jul 8, 2014
1 parent f7005da commit 351a916
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 14 deletions.
2 changes: 1 addition & 1 deletion dist/cropper.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Cropper v0.3.6
* Cropper v0.3.7
* https://github.com/fengyuanchen/cropper
*
* Copyright 2014 Fengyuan Chen
Expand Down
11 changes: 6 additions & 5 deletions dist/cropper.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Cropper v0.3.6
* Cropper v0.3.7
* https://github.com/fengyuanchen/cropper
*
* Copyright 2014 Fengyuan Chen
Expand Down Expand Up @@ -202,11 +202,13 @@
cropper.left = (container.width - cropper.width) / 2;
}

cropper = Cropper.fn.floor(cropper);
// Calculate the ratio value first before use the "Math.floor"
// https://github.com/fengyuanchen/cropper/issues/34
image.ratio = cropper.width / image.naturalWidth;

cropper = Cropper.fn.floor(cropper);
image.height = cropper.height;
image.width = cropper.width;
image.ratio = image.width / image.naturalWidth;

Cropper.fn.position($container);
this.$cropper.css({
Expand Down Expand Up @@ -786,8 +788,7 @@
data = $this.data("cropper");

if (!data) {
data = new Cropper(this, options);
$this.data("cropper", data);
$this.data("cropper", (data = new Cropper(this, options)));
}

if (typeof options === "string" && $.isFunction(data[options])) {
Expand Down
2 changes: 1 addition & 1 deletion dist/cropper.min.css

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

4 changes: 2 additions & 2 deletions dist/cropper.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "cropper",
"description": "A simple jQuery image cropping plugin.",
"version": "0.3.6",
"version": "0.3.7",
"keywords": [
"image",
"cropping",
Expand Down
9 changes: 5 additions & 4 deletions src/cropper.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,13 @@
cropper.left = (container.width - cropper.width) / 2;
}

cropper = Cropper.fn.floor(cropper);
// Calculate the ratio value first before use the "Math.floor"
// https://github.com/fengyuanchen/cropper/issues/34
image.ratio = cropper.width / image.naturalWidth;

cropper = Cropper.fn.floor(cropper);
image.height = cropper.height;
image.width = cropper.width;
image.ratio = image.width / image.naturalWidth;

Cropper.fn.position($container);
this.$cropper.css({
Expand Down Expand Up @@ -778,8 +780,7 @@
data = $this.data("cropper");

if (!data) {
data = new Cropper(this, options);
$this.data("cropper", data);
$this.data("cropper", (data = new Cropper(this, options)));
}

if (typeof options === "string" && $.isFunction(data[options])) {
Expand Down

0 comments on commit 351a916

Please sign in to comment.