Settle leases, styles, credits and controls in the renderer contract

- claimPointer takes a grab filter, asked on each down: a lease takes
  only the presses it grabs, and wheel, pinch and every other press stay
  with the camera and everyone else. Each event of a press goes where its
  down went, per button, so a claim never takes a press under way.
- The app owns the styles: effects.defineStyle passes a GLSL (and optionally
  WGSL) full-screen pass, with the shader interface written out.
- Credits are plain data ({ text, href, logoUrl, inline }) that the app
  renders; CreateOptions.creditContainer goes.
- controls.coast { drag, zoom } in seconds replaces the inertia trio; the
  stub's defaults are the default renderer's, converted.
- The frame order is the default renderer's own: a move made by follow or
  in preUpdate reaches changed on the next frame.
This commit is contained in:
Sameh Khamis committed 2026-11-05 13:11:59 -08:00
1 parent b7c26351f7
commit a7aeeb558a
12 files changed
+591 -34

No files matched your search

+33 -5
View File
@@ -3,9 +3,26 @@
*
* A tool takes the pointer with a lease; while a lease is out, ambient
* subscribers (those without a lease) get only `move` and `up`: no presses,
* clicks, double-clicks, wheel or pinch. Suspending camera
* input is separate and counted, and takes effect on the same pointerdown
* that asked for it.
* clicks, double-clicks, wheel or pinch. A lease with `grab` takes only the
* presses it grabs: `grab` is asked on each `down`, and a grabbed press (its
* `down`, and the `click` and `dblclick` it ends in) goes to the lease's
* listeners alone. Every other press, and wheel and pinch, go to ambient
* subscribers and the camera as if the pointer were free; `move` and `up`
* go to both.
*
* Every event of a press goes where its `down` went, even when the lease
* ends or changes before the press is over (an ended lease's to no one), so
* a claim never takes a press already under way. Each button's presses
* are separate. A press runs from its `down` through its `up`, the `click`
* straight after it where it went up, and a `dblclick` straight after that
* at the same spot;
* any other event after its `up` ends it. A click or double-click with no
* press of its own is decided as a press, `grab` seeing it as a `down`
* (without `pick`, `drill` or `ground`).
*
* Suspending camera input is separate and counted, and takes effect on the
* same pointerdown that asked for it, so a tool that grabs a press suspends
* the camera in its `down` listener.
*
* A click is delivered with its pick already made, once, and shared by
* every subscriber (`PointerEv.pick`). Where the renderer's picks answer a
@@ -70,8 +87,19 @@ export interface InputPort {
cb: (ev: PointerEv) => void,
options?: { lease?: Lease | (() => Lease | null) },
): Off;
/** Take the pointer for a tool. A new claim ends the previous lease. */
claimPointer(owner: string): Lease;
/**
* Take the pointer for a tool. A new claim ends the previous lease.
* `grab` decides each press from its `down` event, synchronously: true
* makes it the tool's, anything else leaves it. A `down` carries no pick,
* so `grab` decides from the position, button and modifiers (and the
* tool's own hit test, through `query`). Omitted, every press is the
* tool's. A `grab` that throws is reported and leaves the press to the
* others.
*/
claimPointer(
owner: string,
options?: { grab?: (down: PointerEv) => boolean },
): Lease;
isPointerFree(): boolean;
/** Suspend user camera input until released. Holds are counted. */
suspendCameraControls(reason: string): Release;