File size: 722 Bytes
bc20498 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
import { PanOnScrollMode, XYPanZoom } from '@xyflow/system';
export default function zoom(domNode, params) {
const { panZoom, minZoom, maxZoom, initialViewport, viewport, dragging, translateExtent, paneClickDistance } = params;
const panZoomInstance = XYPanZoom({
domNode,
minZoom,
maxZoom,
translateExtent,
viewport: initialViewport,
paneClickDistance,
onDraggingChange: dragging.set
});
const currentViewport = panZoomInstance.getViewport();
viewport.set(currentViewport);
panZoom.set(panZoomInstance);
panZoomInstance.update(params);
return {
update(params) {
panZoomInstance.update(params);
}
};
}
|