Skip to content

Commit

Permalink
Fixed #21: Limit wheel zoom speed
Browse files Browse the repository at this point in the history
  • Loading branch information
Fengyuan Chen committed Dec 19, 2015
1 parent 4a77ca1 commit 7a28cef
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/js/cropper.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
_this.disabled = false;
_this.replaced = false;
_this.limited = false;
_this.wheeled = false;
_this.isImg = false;
_this.originalUrl = '';
_this.canvasData = null;
Expand Down
11 changes: 11 additions & 0 deletions src/js/handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,17 @@

preventDefault(e);

// Limit wheel speed to prevent zoom too fast (#21)
if (_this.wheeled) {
return;
}

_this.wheeled = true;

setTimeout(function () {
_this.wheeled = false;
}, 50);

if (e.deltaY) {
delta = e.deltaY > 0 ? 1 : -1;
} else if (e.wheelDelta) {
Expand Down

0 comments on commit 7a28cef

Please sign in to comment.