PanZoomOptions

What an environment supplies to usePanZoomGestures: the arithmetic of its own view, not the binding.

@internote/canvas-sdk/reactInterface
On this page
import { PanZoomOptions } from '@internote/canvas-sdk/react';

#Fields

baseRequired
Returns the view a gesture starts from: the reader's, else the one the surface drew. null declines the gesture. A move already queued this frame takes precedence.
V | null
clamp
Returns a queued view held to the limits the reader may not leave.
V
commitRequired
Called at most once a frame, with the view as it settled.
void
drag
Returns the view after the pointer moved, or null to ignore the move. Absent means this surface does not pan.
V | null
enabledRequired
Whether the gestures are bound at all. When false the reader may not move this view.
boolean
resetRequired
Called on double-click, to hand the frame back to the author.
void
wheelRequired
Returns the view after one wheel notch, or null to ignore it.
V | null

#Example

usePanZoomGestures(svgRef, {
    enabled: explorable,
    base: () => view.current(ctx),
    wheel: (from, event) => zoomAbout(from, event.deltaY, pointOf(event)),
    drag: (from, was, now) => panBy(from, now.x - was.x, now.y - was.y),
    commit: (next) => view.glide(ctx, next),
    reset: () => view.reset(ctx),
});

Declared in packages/canvas-sdk/src/react/use-pan-zoom-gestures.ts:51.

Last updated