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

Add zoomSpeed-prop and use it to multiply the wheelzoom #21

Merged
merged 2 commits into from
Jan 8, 2019

Conversation

TheRealSlapshot
Copy link
Contributor

I added a "zoomSpeed"-prop, which basically just multiplies the deltaY of a mousewheel-turn before adding it to the previous zoom.

closes #20

README.md Outdated Show resolved Hide resolved
@@ -169,7 +169,7 @@ class Cropper extends React.Component {
onWheel = e => {
e.preventDefault()
const point = Cropper.getMousePoint(e)
const newZoom = this.props.zoom - e.deltaY / 200
const newZoom = this.props.zoom - (e.deltaY * this.props.zoomSpeed) / 200
Copy link
Owner

Choose a reason for hiding this comment

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

I don't really like the hardcoded 200 value. Do you think we could combine it with the zoomSpeed property (and keep "approximatively" the same behavior as today)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't see, how we can combine this.
We could extract the hardcoded number to a class constant, but this is out of scope of this PR in my opinion.

Copy link
Owner

Choose a reason for hiding this comment

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

OK it's fine to me.

@ValentinH
Copy link
Owner

Thanks for this PR 🙂
See my review comments above.

@ValentinH ValentinH merged commit 4437610 into ValentinH:master Jan 8, 2019
@ValentinH
Copy link
Owner

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.

Feature Request: Make mouse-wheel zoom-speed configurable
2 participants