Skip to content

createControls.navigation#enabled

Summary

createControls.navigation#enabled gates frame updates and interactive camera input. Toggle it when a modal or another tool temporarily takes over the canvas. Use the per-mode flags to keep selected gestures available.

Syntax

NavigationControls.enabled: boolean
NavigationControls.enableRotate: boolean
NavigationControls.enablePan: boolean
NavigationControls.enableZoom: boolean
NavigationControls.enableKeyboard: boolean
NavigationControls.enablePointer: boolean
NavigationControls.enableWheel: boolean
controls.enableZoom = false;

Notes

All seven flags default to true. The rotate, pan and zoom flags control orbit and trackball gestures. In fly mode, the keyboard flag gates movement and roll, the pointer flag gates looking, and the wheel flag gates wheel speed adjustments. Disabling updates leaves the event listeners registered. Use dispose when the controls are no longer needed.

Example

const camera = wgpu.createCamera.perspective();
const controls = wgpu.createControls.navigation(camera, document.querySelector("canvas"));
controls.enableRotate = false;
controls.enableZoom = false;
controls.update();
controls.dispose();
camera.destroy();

See Also