daybrush / infinite-viewer

Infinite Viewer is Document Viewer Component with infinite scrolling.
https://daybrush.com/infinite-viewer/
MIT License
296 stars 32 forks source link

Getting moving right glitch issue when mouse wheel scrolling on the zoomed out browser at 67% #76

Open momcilo330 opened 1 month ago

momcilo330 commented 1 month ago

Hi, I am getting scared issue when scrolling mouse wheel on the zoom out browser at like 67% I've made a very simple code for this issue, Here is my screenshot of code and screen. Please fix image scrollIssueAt67%.webm

momcilo330 commented 1 month ago

I found the solution. I think the moving glitch issue occurs due to incompatible browser's zoom with app. So there gets difference value than the real value. By trying many times, I noticed this issue occurs when deltaX, deltaY equals to -0.5, otherwise it works well. image

So I've fixed this issue by adding a code in file: src/InfiniteViewerManager.tsx at line 846 and 847

const deltaX = Math.abs(scrollLeft - this.scrollLeft) < 1 ? 0 : scrollLeft - this.scrollLeft;
const deltaY = Math.abs(scrollTop - this.scrollTop) < 1 ? 0 : scrollTop - this.scrollTop;

image

And you need to import the library into your source file because I don't think the admin update & build this issue soon. In that case, you have to build this tsx file into babel js file.

Hope the Admin can fix and update soon!