daybrush / infinite-viewer

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

there is no way to find viewer's relative position at current mouse pos. #54

Closed enk0de closed 1 year ago

enk0de commented 1 year ago

there is no way to find viewer's relative position at current mouse pos. is there any way to find it that i don't know?

daybrush commented 1 year ago

@hoondeveloper

Perhaps you use the mousemove event? I guess you could use something like this:

viewer.getContainer().addEventListener("mousemove", e => {
     const rect = viewer.getContainer().getBoundingClientRect();
     const dx = e.clientX - rect.left;
     const dy = e.clientY - rect.top;
});
enk0de commented 1 year ago

Oh i see. Thanks. I'll use it.