Re: [w3c/pointerlock] feature request : Allow to set pointer position upon release (#61)

I also need this capability for nearly the same reason. I'm building a node editor library that features a large canvas and allows dragging around nodes and creating connections. Dragging around objects inside of the screen and also dragging with panning as they hit the edge is not a use case currently implementable by combing setPointerCapture and requestPointerLock.

Imagine the simple scenario where you drag a rectangle left inside of a large canvas. As you drag left the mouse moves to the left. When the rectangle hits the canvas's left side the displayed mouse needs to stop moving and the canvas should begin panning left.

Using setPointerCapture works until the rectangle hits the left. If you attempt to solve this by calling requestPointerLock (and optionally drawing a fake cursor) you can then scroll left more and all is well. That is until you move the mouse up or down. If you move the cursor up the rectangle moves up but the cursor position stays where the requestPointerLock started. That means when you release the cursor is no longer on top of the rectangle in the same spot.

So the only feasible way for this to work is to allow the cursor position to be defined on exitPointerLock as explained.

With WebGPU releasing it's becoming extremely viable to implement advanced applications offering things like material editors and such directly into the browser. Being able to duplicate the UX found in professional software 1:1 will be important in making these solutions viable.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3c/pointerlock/issues/61#issuecomment-1106005425
You are receiving this because you are subscribed to this thread.

Message ID: <w3c/pointerlock/issues/61/1106005425@github.com>

Received on Friday, 22 April 2022 04:54:54 UTC