Skip to content

Commit

Permalink
Fix e.key checks and build
Browse files Browse the repository at this point in the history
  • Loading branch information
infensus authored and infensus committed Aug 8, 2019
1 parent f4ac4e0 commit 4c21e66
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 14 deletions.
2 changes: 1 addition & 1 deletion dist/ReactCrop.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/ReactCrop.min.js

Large diffs are not rendered by default.

15 changes: 4 additions & 11 deletions lib/ReactCrop.js
Original file line number Diff line number Diff line change
Expand Up @@ -396,16 +396,16 @@ class ReactCrop extends PureComponent {
const nextCrop = this.makeNewCrop();
const nudgeStep = e.shiftKey ? ReactCrop.nudgeStepLarge : ReactCrop.nudgeStep;

if (keyCode === ReactCrop.arrowKey.left) {
if (keyCode === 'ArrowLeft') {
nextCrop.x -= nudgeStep;
nudged = true;
} else if (keyCode === ReactCrop.arrowKey.right) {
} else if (keyCode === 'ArrowRight') {
nextCrop.x += nudgeStep;
nudged = true;
} else if (keyCode === ReactCrop.arrowKey.up) {
} else if (keyCode === 'ArrowUp') {
nextCrop.y -= nudgeStep;
nudged = true;
} else if (keyCode === ReactCrop.arrowKey.down) {
} else if (keyCode === 'ArrowDown') {
nextCrop.y += nudgeStep;
nudged = true;
}
Expand Down Expand Up @@ -794,13 +794,6 @@ ReactCrop.xOrds = ['e', 'w'];
ReactCrop.yOrds = ['n', 's'];
ReactCrop.xyOrds = ['nw', 'ne', 'se', 'sw'];

ReactCrop.arrowKey = {
left: 37,
up: 38,
right: 39,
down: 40,
};

ReactCrop.nudgeStep = 0.2;
ReactCrop.nudgeStepLarge = 2;

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-image-crop",
"version": "8.2.0",
"version": "8.2.1",
"description": "A responsive image cropping tool for React",
"repository": "https://github.com/DominicTobias/react-image-crop",
"main": "dist/ReactCrop.min.js",
Expand Down

1 comment on commit 4c21e66

@jthistle
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, I caused this unfortunately. I was just about to make a PR for it but you got there before me, it seems. Sorry about that 😬

Please sign in to comment.