Closed leidto closed 1 year ago
Same issue: would it be possible to add dragging via the mouse wheel button (like Figma or Miro)? It would be super helpful!
Thanks a lot @daybrush for your hard work on this project!
@leidto @anas-araid
If wheel button in dragStart event, stop with e.stop
function.
viewer.on("dragStart", e => {
// Abort on wheel button.
if (e.inputEvent.button === 1) {
e.stop();
return;
}
});
Thanks for your comment @daybrush. I've tried it but doesn't work with the react version. My goal is to use the useMouseDrag property with the mouse middle button not with the left button. I've tried several ways but I can't figure out how it's possible.
I can disable the original wheel and scroll event:
viewerRef.current.getElement().addEventListener('wheel', (e) => { ... }
, but I have to trigger the onDrag method somehow when middle mouse is pressed. I'm stuck.
@leidto
I'll probably fix it and release it this week.
@leidto
infinite-viewer's new version is released.
Update and set preventWheelClick
to false.
And use:
viewer.on("dragStart", e => {
// only allow wheel
if (e.inputEvent.button !== 1) {
e.stop();
return;
}
});
Thank you. It works perfectly!
useMouseDrag prop is great but I should do the same if the middle mouse button pressed. How can I do this?