infinite-viewer
infinite-viewer copied to clipboard
Question: Why is it scrolling with an "offset"?
Hey @daybrush - I know this isn't much, but maybe you have some ideas why this could be happening 👇
https://user-images.githubusercontent.com/437214/228061042-fed2b3c3-cac8-4ac1-91f5-672922688277.mp4
When I scroll it doesn't "stick" to the point where the cursor is and starts slowly moving away. This is my config:
<InfiniteViewer
ref={viewerRef}
useWheelScroll
wheelPinchKey='meta'
useAutoZoom
zoomRange={[CANVAS_VIEWER_MIN_SCALE, CANVAS_VIEWER_MAX_SCALE]}
wheelScale={0.005}
threshold={100}
onPinch={(event) => {
const { zoom: newZoom } = event
viewerRef.current?.setZoom(newZoom)
}}
>
{children}
</InfiniteViewer>
I can see it's working in your demo, so it must be something on my end. I know it's tough without actual reproduction, but MAYBE you already see what might be causing that.
Thank you
@bytasv
Um... I don't know.
But let's take a few guesses
If the container and viewport sizes are different from the stored values, the following problems may occur.
Try useResizeObserver. The size will automatically update.
Thanks for guess! But useResizeObserver
didn't help :( I know it's impossible to debug, but maybe someone will bump into similar issue and find a solution, or maybe I will eventually find out why its happening and can share that 😅