Show local cursor while dragging the viewport
See #1991 for details.
Add view_drag parameter to enable dragging when connected.
I dived deeper into the code and came closer to #1991 again.
There are some reasons to show a local cursor:
- We are connected to a buggy server
- We are connected to a device without a cursor (kiosk, POS)
- We are visually handicapped or the content of the screen makes it impossible to realize the dot
There are some situations to show a local cursor:
- Whilst dragging the viewport to have a visual feedback
- Whilst dragging is enabled but the mouse is up to distinguish the condition if the control bar is not visible or accessible
- Whilst in view-only mode and the dot is too small
- Whilst the server hasn't send a cursor, from core/rfb.js:
// XXX: TightVNC 2.8.11 sends no cursor at all until Windows changes // it. Result: no cursor at all until a window border or an edit field // is hit blindly. But there are also VNC servers that draw the cursor // in the framebuffer and don't send the empty local cursor. There is // no way to satisfy both sides. - As the 'defalut' cursor
With this PR the RFB class gets a new property showLocalCursor which is either false or falsy or an object with the following properties:
default:viewOnly:drag:dragging:empty:
The values are set as the cursor for the RFB view as documented at MDN. So have the options to set an 'embedded', an URL to an image or a data URI.
For the following screen capture I used another cursor set and the following local cursor:
UI.rfb.showLocalCursor = {
drag: 'grab',
dragging: 'grabbing',
viewOnly: 'help',
empty: 'url("https://upload.wikimedia.org/wikipedia/commons/f/f5/Cursor_%3F.svg") 10 10, default',
};
(As before, there are problems with the first few seconds, try to download or open an another tab.)
https://github.com/user-attachments/assets/3bbae19f-01e9-4960-af37-ec898d82335c
There is an export of this branch at https://download.bitctrl.de/novnc-u6Nm/noVNC-feature-drag-viewport-cursor/vnc.html#path=https://localhost:6443/addr:192.0.2.2&view_clip=1&view_drag=1&autoconnect=1