MouseLookProvider
Defined in: src/modules/input/mouse-look.ts:82
Reports relative pointer motion while the pointer is locked to target, and
tracks the lock itself. It binds no input gesture of its own — the consumer
calls requestLock() from whichever click should capture.
Mirrors PointerProvider’s split: a subscribe channel for the continuous
signal, plus a read-only state for the discrete flag. That flag is the one
thing a consumer cannot derive from the delta stream, which is why it is
exposed rather than left to document.pointerLockElement reads.
Motion is ignored while an element other than target holds the lock — an
overlay, or a second provider capturing the same pointer — so it cannot
steer the camera.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new MouseLookProvider(
options):MouseLookProvider
Defined in: src/modules/input/mouse-look.ts:95
Parameters
Section titled “Parameters”options
Section titled “options”Returns
Section titled “Returns”MouseLookProvider
Properties
Section titled “Properties”
readonlystate:MouseLookState
Defined in: src/modules/input/mouse-look.ts:91
Methods
Section titled “Methods”dispose()
Section titled “dispose()”dispose():
void
Defined in: src/modules/input/mouse-look.ts:144
Detach every listener and release the lock. Idempotent: afterwards the
provider is inert — a second dispose(), requestLock() and unlock() are
all no-ops, and a handler registered later never fires. Restores the
unlocked cursor before releasing, because the lock-change listener is gone
by the time the browser confirms the exit.
Returns
Section titled “Returns”void
requestLock()
Section titled “requestLock()”requestLock():
void
Defined in: src/modules/input/mouse-look.ts:183
Ask the browser to capture the pointer. No-op when already captured or disposed, and when there is no lock source to observe the result — capturing blind could strand the pointer with no way to release it.
The capture gesture is the consumer’s to bind: doom fires on the same mousedown that captures (and must not fire on it), while portal must not capture on the right click that fires an orange portal. So the provider exposes the action and leaves the trigger to the app.
Returns
Section titled “Returns”void
subscribe()
Section titled “subscribe()”subscribe(
handler): () =>void
Defined in: src/modules/input/mouse-look.ts:204
Subscribe to relative motion. Returns an unsubscribe function. Deltas are delivered at event time, so a consumer that applies them immediately gets motion between ticks rather than quantised to the tick rate.
A motion event carrying no delta (or a zero sensitivity) emits nothing.
Parameters
Section titled “Parameters”handler
Section titled “handler”(delta) => void
Returns
Section titled “Returns”() => void
unlock()
Section titled “unlock()”unlock():
void
Defined in: src/modules/input/mouse-look.ts:219
Release the pointer lock. No-op when not captured or already disposed.
The DOM confirms the release asynchronously, so an unlock() followed by a
dispose() in the same tick requests the exit twice — redundant, but the
end state is the same, and tracking the in-flight release would cost more
state than the saved call is worth.
Returns
Section titled “Returns”void