feat(props): add panActivationKeyCode

This commit is contained in:
moklick
2022-12-12 16:35:39 +01:00
parent d34ecbf802
commit ee2f39f2fe
6 changed files with 13 additions and 56 deletions
@@ -53,11 +53,12 @@ const ZoomPane = ({
panOnScrollMode = PanOnScrollMode.Free,
zoomOnDoubleClick = true,
elementsSelectable,
panOnDrag = true,
panOnDrag: _panOnDrag = true,
defaultViewport,
translateExtent,
minZoom,
maxZoom,
panActivationKeyCode,
zoomActivationKeyCode,
preventScrolling = true,
children,
@@ -72,6 +73,8 @@ const ZoomPane = ({
const prevTransform = useRef<Viewport>({ x: 0, y: 0, zoom: 0 });
const { d3Zoom, d3Selection, d3ZoomHandler, userSelectionActive } = useStore(selector, shallow);
const zoomActivationKeyPressed = useKeyPress(zoomActivationKeyCode);
const panActivationKeyPressed = useKeyPress(panActivationKeyCode);
const panOnDrag = _panOnDrag || panActivationKeyPressed;
useResizeHandler(zoomPane);