feat(interactive-minimap): add zoom and pan

This commit is contained in:
moklick
2022-10-31 17:55:32 +01:00
parent 8323ee0c91
commit 322ea0ebed
3 changed files with 86 additions and 14 deletions
@@ -173,9 +173,12 @@ const ZoomPane = ({
useEffect(() => {
if (d3Zoom) {
d3Zoom.on('start', (event: D3ZoomEvent<HTMLDivElement, any>) => {
if (!event.sourceEvent) {
return null;
}
const { onViewportChangeStart } = store.getState();
isZoomingOrPanning.current = true;
if (event.sourceEvent?.type === 'mousedown') {
store.setState({ paneDragging: true });
}
@@ -194,6 +197,9 @@ const ZoomPane = ({
useEffect(() => {
if (d3Zoom) {
d3Zoom.on('end', (event: D3ZoomEvent<HTMLDivElement, any>) => {
if (!event.sourceEvent) {
return null;
}
const { onViewportChangeEnd } = store.getState();
isZoomingOrPanning.current = false;