You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am having trouble getting two finger pan and drag to work like it does in the demo. I seem to have pinch working but I would prefer it to zoom to the mouse position like it does in the demo. Is this all supposed to work out of the box or does one need to implement this?
"use client";importReact,{useEffect,useState,useRef}from"react";importInfiniteViewerfrom"react-infinite-viewer";exportdefaultfunctionGestures({ children }: {children: React.ReactNode}){const[zoom,setZoom]=useState(1);return(<InfiniteViewerclassName="viewer"usePinch={true}useMouseDrag={true}useWheelScroll={true}useAutoZoom={true}zoomRange={[0.1,10]}maxPinchWheel={10}zoom={zoom}margin={0}threshold={0}rangeX={[0,0]}rangeY={[0,0]}onDragStart={(e)=>{consttarget=e.inputEvent.target;console.log(target);if(target.nodeName==="A"){e.stop();}}}onScroll={(e)=>{console.log(e);}}onPinch={(e)=>{constnewZoom=Math.max(0.1,e.zoom);setZoom(newZoom);console.log("Pinch",newZoom);}}>{children}</InfiniteViewer>);}
Would really appreciate some help. This could be a helpful react example it someone could assists.
Note that in my example, children is an svg
Thanks!
The text was updated successfully, but these errors were encountered:
I am having trouble getting two finger pan and drag to work like it does in the demo. I seem to have pinch working but I would prefer it to zoom to the mouse position like it does in the demo. Is this all supposed to work out of the box or does one need to implement this?
Would really appreciate some help. This could be a helpful react example it someone could assists.
Note that in my example,
children
is an svgThanks!
The text was updated successfully, but these errors were encountered: