For the SlyZoom extension I have created, I want to implement a virtual slider: a XUL/XBL element that acts as a small static region where, on mousedown
, the mouse pointer changes to ew-resize
and I capture mousemove
events to detect horizontal movement, to change the current zoom level.
So far I have implemented a tentative solution, using the standard MouseEvent API and utilizing the very handy MouseEvent.mozMovementX, that seem to be present even when I'm not using the Pointer Lock API.
In this example image you see the (Xubuntu) ew-resize
mouse pointer over the provisional virtual slider, which is the region, with the small black double arrow behind the mouse pointer, on the left side of the <menulist>
:
The right side of this image is the right edge of the screen; the left side is simply cropped.
However, as you can see/imagine, it is very likely that the mouse pointer will regularly reach the edge of users' screens before they've reached a satisfactory zoom level. In those cases, unfortunately, MouseEvent.mozMovementX
will simply stay zero, even though the physical pointer device is still moving.
I've tried to circumvent this by using the Pointer Lock API. However, it appears as though the Pointer Lock API does not work for XUL/XBL documents. Is that correct? Or is the Pointer Lock API supposed to work for XUL/XBL documents as well?
In any case, even if the Pointer Lock API was working for my XBL element, it would hide the mouse pointer, and that is not desirable. Although I guess I could try to create a faux mouse pointer in that case, but that is rather cumbersome and prone to erratic behavior, I'm afraid.
So my question boils down to this:
How can I properly detect mousemove deltas beyond screen edges in XUL/XBL documents? Is this possible, somehow?