react-zoom-pan-pinch
react-zoom-pan-pinch copied to clipboard
activation keys not working
Hi :) I was trying to use activationKeys prop with different keys to allow the wheel only with them. for example: allow wheeling only when alt is pressed.
<TransformWrapper
initialScale={1}
maxScale={2}
wheel={{step: 0.4, activationKeys: ["18", "alt"]}}
doubleClick={{disabled: true}}
onWheel={({state: {scale}}) => setCurrentZoom(scale)}
>
The actual result is that it's disabled the wheel option completely.
+1
For what it's worth this works for me
<TransformWrapper
wheel={{ step: 0.4, activationKeys: ["z"] }}
/>
It uses KeyboardEvent.key
to check wich key is being pressed. So you need to set "Alt" with first uppercase.
https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key