Skip to content

Commit

Permalink
Fixed bug that when preview has border and border-box sized, previewS…
Browse files Browse the repository at this point in the history
…ize is wrong
  • Loading branch information
Scott Cheng committed Feb 29, 2016
1 parent 9b28d75 commit e9fcfd1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions dist/jquery.cropit.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,8 @@ return /******/ (function(modules) { // webpackBootstrap
this.$zoomSlider = this.options.$zoomSlider.attr({ min: 0, max: 1, step: 0.01 });

this.previewSize = {
width: this.options.width || this.$preview.width(),
height: this.options.height || this.$preview.height()
width: this.options.width || this.$preview.innerWidth(),
height: this.options.height || this.$preview.innerHeight()
};

this.$image = (0, _jquery2['default'])('<img />').addClass(_constants.CLASS_NAMES.PREVIEW_IMAGE).attr('alt', '').css({
Expand Down Expand Up @@ -873,8 +873,8 @@ return /******/ (function(modules) { // webpackBootstrap
height: size.height
};
this.$preview.css({
width: this.previewSize.width,
height: this.previewSize.height
innerWidth: this.previewSize.width,
innerHeight: this.previewSize.height
});

if (this.imageLoaded) {
Expand Down
8 changes: 4 additions & 4 deletions src/cropit.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ class Cropit {
this.$zoomSlider = this.options.$zoomSlider.attr({ min: 0, max: 1, step: 0.01 });

this.previewSize = {
width: this.options.width || this.$preview.width(),
height: this.options.height || this.$preview.height(),
width: this.options.width || this.$preview.innerWidth(),
height: this.options.height || this.$preview.innerHeight(),
};

this.$image = $('<img />')
Expand Down Expand Up @@ -644,8 +644,8 @@ class Cropit {
height: size.height,
};
this.$preview.css({
width: this.previewSize.width,
height: this.previewSize.height,
innerWidth: this.previewSize.width,
innerHeight: this.previewSize.height,
});

if (this.imageLoaded) {
Expand Down

0 comments on commit e9fcfd1

Please sign in to comment.