Skip to main content

Class: PanZoomControls

Defined in: src/interaction/PanZoomControls.ts:105

Desmos-style mouse pan and zoom for a 2D (orthographic) manim camera.

Wheel zooms the frame about the world point under the cursor (zoom to cursor, not to center); a pointer drag pans the frame. The controller only reads/writes the camera through PanZoomCamera; it never touches the core render path, so it is a pure opt-in input controller.

Lifecycle mirrors OrbitControls: listeners are attached while the controller is enabled and removed on disable() / dispose().

Example​

const controls = new PanZoomControls(scene.camera, scene.getCanvas(), {
onChange: () => scene.render(),
});
// later
controls.dispose();

Constructors​

Constructor​

new PanZoomControls(camera, domElement, options?): PanZoomControls

Defined in: src/interaction/PanZoomControls.ts:129

Parameters​

camera​

PanZoomCamera

The 2D camera to drive (e.g. scene.camera).

domElement​

HTMLElement

The element that receives wheel/pointer events (e.g. the canvas).

options?​

PanZoomControlsOptions

Pan/zoom configuration.

Returns​

PanZoomControls

Methods​

disable()​

disable(): void

Defined in: src/interaction/PanZoomControls.ts:183

Detach listeners. The controller stops responding until enable() is called.

Returns​

void


dispose()​

dispose(): void

Defined in: src/interaction/PanZoomControls.ts:199

Permanently detach listeners. The controller cannot be re-enabled.

Returns​

void


enable()​

enable(): void

Defined in: src/interaction/PanZoomControls.ts:169

Attach listeners and start responding to the mouse.

Returns​

void


isEnabled()​

isEnabled(): boolean

Defined in: src/interaction/PanZoomControls.ts:164

Whether the controller is currently enabled (listeners attached).

Returns​

boolean