diff --git a/docs/API.md b/docs/API.md index d78360a2..780001bc 100644 --- a/docs/API.md +++ b/docs/API.md @@ -113,6 +113,10 @@ protocol stream. - The `capabilities` event is fired when `RFB.capabilities` is updated. +[`pointerlock`](#pointerlock) + - The `pointerlock` event is fired when the Pointer Lock is acquired (or + released) by the canvas. + ### Methods [`RFB.disconnect()`](#rfbdisconnect) @@ -146,6 +150,9 @@ protocol stream. [`RFB.clipboardPasteFrom()`](#rfbclipboardPasteFrom) - Send clipboard contents to server. +[`RFB.requestPointerLock()`](#rfbrequestPointerLock) + - Requests that the RFB canvas acquire a Pointer Lock. + ### Details #### RFB() @@ -262,6 +269,15 @@ The `capabilities` event is fired whenever an entry is added or removed from `RFB.capabilities`. The `detail` property is an `Object` with the property `capabilities` containing the new value of `RFB.capabilities`. +#### pointerlock + +The `pointerlock` event is fired when the state of the canvas' Pointer Lock has +changed, either because it has successfully acquired the lock and will have +full control of the mouse pointer, or because the lock was released by the user +pressing the ESC key or performing a browser-specific gesture. The `detail` +property is an `Object` with the property `pointerlock` containing whether the +lock is currently held or not. + #### RFB.disconnect() The `RFB.disconnect()` method is used to disconnect from the currently @@ -383,3 +399,19 @@ to the remote server. **`text`** - A `DOMString` specifying the clipboard data to send. + +#### RFB.requestPointerLock() + +The `RFB.requestPointerLock()` method is used to request that the RFB canvas +hold a [Pointer +Lock](https://developer.mozilla.org/en-US/docs/Web/API/Pointer_Lock_API), which +hides the mouse cursor and provides relative motion events. This must be called +directly from an event handler where a user has directly interacted with the +browser for the browser to allow this. + +If the acquisition of the pointer lock is successful, a `pointerlock` event +will be fired. + +##### Syntax + + RFB.requestPointerLock( );