Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow nuding in multiple directions #388

Merged
merged 1 commit into from Oct 5, 2020
Merged

Allow nuding in multiple directions #388

merged 1 commit into from Oct 5, 2020

Conversation

mskelton
Copy link
Contributor

@mskelton mskelton commented Oct 2, 2020

Currently, if you hold down multiple keys when nudging, the cropper will pick the most recently pressed key and use it for the nudge direction. This can make it confusing when attempting to crop towards a corner. This PR adds a new variable to the class called keysDown (essentially a ref since it doesn't need to be state) which tracks the keys that are currently down. Then, when keydown is fired we can calculate the nudge based on all the keys which are down.

The main question I have for you about this PR is my usage of Set which I'm not sure if that is okay based on the browser support of this library. The mdn docs would seem to indicate that even IE11 supports the add, has, and delete methods which is all that I needed to use for this PR. I assume then it's okay to use? If so, I'll need to fix the ESLint warning about Set not being defined.

@DominicTobias-b1
Copy link
Collaborator

DominicTobias-b1 commented Oct 5, 2020

Thanks for this 👍 Will test it in the next couple of days but looks good. Yeah I don't see an issue with using Set as you have

@DominicTobias-b1 DominicTobias-b1 merged commit ab5dc00 into sekoyo:master Oct 5, 2020
@mskelton mskelton deleted the nudge-to-corner branch October 5, 2020 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants