Skip to content

Commit

Permalink
Merge branch 'master' of github.com:mnogueron/react-easy-panzoom
Browse files Browse the repository at this point in the history
  • Loading branch information
mnogueron committed Aug 1, 2019
2 parents b2dd197 + 5cacff2 commit b2b73e1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ render() {
|disabled|`bool`|false|Disable pan and zoom|
|disableKeyInteraction|`bool`|false|Disable keyboard interaction|
|disableDoubleClickZoom|`bool`|false|Disable zoom when performing a double click|
|disableScrollZoom|`bool`|false|Disable zoom when performing a scroll|
|realPinch|`bool`|false|Enable real pinch interaction for touch events|
|keyMapping|`object`|false|Define specific key mapping for keyboard interaction (e.g. `{ '<keyCode>': { x: 0, y: 1, z: 0 } }`, with `<keyCode>` being the key code to map)|
|minZoom|`number`| |Sets the minimum zoom value|
Expand Down
5 changes: 4 additions & 1 deletion src/PanZoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ type Props = {
autoCenterZoomLevel?: number,
disableKeyInteraction?: boolean,
disableDoubleClickZoom?: boolean,
disableScrollZoom?: boolean,
realPinch?: boolean,
keyMapping?: { [string]: { x: number, y: number, z: number }},
minZoom: number,
Expand Down Expand Up @@ -105,6 +106,7 @@ class PanZoom extends React.Component<Props, State> {
boundaryRatioVertical: 0.8,
boundaryRatioHorizontal: 0.8,
disableDoubleClickZoom: false,
disableScrollZoom: false,
preventPan: () => false,
}

Expand Down Expand Up @@ -281,7 +283,8 @@ class PanZoom extends React.Component<Props, State> {
}

onWheel = (e: WheelEvent) => {
if (this.props.disabled) {
const { disableScrollZoom, disabled } = this.props
if (disableScrollZoom || disabled) {
return
}

Expand Down
10 changes: 10 additions & 0 deletions stories/PanZoom.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,16 @@ storiesOf('react-easy-panzoom', module)
</Box>
</DefaultPanZoom>
))
.add('Disable Scroll Zoom Event', () => (
<DefaultPanZoom
maxZoom={Infinity}
disableScrollZoom={boolean('Disable Scroll Zoom', true)}
>
<Box>
Scroll should not zoom
</Box>
</DefaultPanZoom>
))
.add('onStateChange handler', () => {
return (
<>
Expand Down

0 comments on commit b2b73e1

Please sign in to comment.