Skip to content

Commit

Permalink
Add props to set custom min and max zoom levels (#11)
Browse files Browse the repository at this point in the history
* Add props to set custom min and max zoom levels

* flip maxZoom and minZoom
  • Loading branch information
MattyBalaam authored and ValentinH committed Aug 3, 2018
1 parent ac6717c commit 68ef7b9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ class Cropper extends React.Component {
}

setNewZoom = zoom => {
const newZoom = Math.min(MAX_ZOOM, Math.max(zoom, MIN_ZOOM))
const newZoom = Math.min(this.props.maxZoom, Math.max(zoom, this.props.minZoom))
this.props.onZoomChange && this.props.onZoomChange(newZoom)
}

Expand Down Expand Up @@ -237,6 +237,8 @@ class Cropper extends React.Component {
Cropper.defaultProps = {
zoom: 1,
aspect: 4 / 3,
maxZoom: MAX_ZOOM,
minZoom: MIN_ZOOM,
}

export default Cropper

0 comments on commit 68ef7b9

Please sign in to comment.