Skip to content

copper3d / Modules / Controls/gestureGate / GestureAxes

Interface: GestureAxes ​

Controls/gestureGate.GestureAxes

Suppresses camera axes for the duration of a gesture that means something else -- scrubbing a slice plane, dragging an annotation anchor, painting on a mesh -- and puts back exactly what was there before.

Restore what was there, never true ​

This is the whole reason to have a helper rather than two assignments. The obvious hand-rolled version disables the axis on pointerdown and re-enables it on pointerup, and it is wrong on any view that was ALREADY locked: a 2D modality with rotation deliberately turned off silently becomes orbitable the first time the reader scrubs it, and nothing ever turns it back off.

Attach the listener in the CAPTURE phase ​

The gate cannot do this for you, and getting it wrong costs a whole gesture. Copper3dTrackballControls listens on the canvas in the bubble phase and latches its rotate state inside its own pointerdown handler (onMouseDown reads noRotate there and copies the pointer position). A listener that opens the gate in the bubble phase runs after that, so the first gesture both scrubs AND orbits:

ts
el.addEventListener("pointerdown", onDown, true);  // <- the `true`
el.addEventListener("pointerdown", onDown, true);  // <- the `true`

Nesting ​

Gates on the same controls object refcount. The first one captures and suppresses; the last one released restores. Each releaser is idempotent, so calling it from both pointerup and pointercancel is safe.

Table of contents ​

Properties ​

Properties ​

pan ​

• Optional pan: boolean

Defined in ​

src/Controls/gestureGate.ts:47


rotate ​

• Optional rotate: boolean

Default true -- rotation is what a drag gesture collides with.

Defined in ​

src/Controls/gestureGate.ts:46


zoom ​

• Optional zoom: boolean

Defined in ​

src/Controls/gestureGate.ts:48