<nve-viewport>
Properties
Fits measurable direct default-slot content once after initial layout.
true
false
Enables panning by pointer, focused wheel, focused keyboard, and Invoker commands; requires Space for primary-pointer dragging when set to space.
boolean
space
Enables zooming by pinch, focused modified wheel, focused keyboard, and Invoker commands.
true
false
CSS-pixel pointer movement required before a pointer pan begins.
number
Default uniform CSS-pixel inset reserved around bounds when fitting content.
number
Inclusive upper scale limit.
number
Inclusive lower scale limit.
number
Whether the viewport may admit new user-input panning.
true
false
Content-to-viewport CSS-pixel scale.
number
Horizontal content-space coordinate at the viewport origin.
number
Vertical content-space coordinate at the viewport origin.
number
Whether the viewport may admit new user-input zooming.
true
false
Scale stops for keyboard and command zoom, clamped to the scale bounds. Defaults to built-in stops; an empty array uses only the bounds.
readonly number[]
Events
Dispatched after pan or zoom availability or scale limits change.
Dispatched once after a render that commits one or more viewport transform changes.
Dispatched when a rendered viewport connects or completes its first render while connected.
Slots
Content positioned in the viewport's infinite content space.
Custom content rendered behind viewport content and excluded from content fitting
Interactive content fixed above the transformed plane and excluded from content fitting
Invoker Commands
With behavior-pan enabled, pans down by one discrete step.
With behavior-pan enabled, pans left by one discrete step.
With behavior-pan enabled, pans right by one discrete step.
With behavior-pan enabled, moves to the source x and y content coordinates.
With behavior-pan enabled, pans up by one discrete step.
With behavior-zoom enabled, animates to the next permitted scale step.
With behavior-zoom enabled, animates to the previous permitted scale step.
With behavior-zoom enabled, animates to 100% scale.
With behavior-zoom enabled, sets the centered scale from the source's numeric scale property.
With behavior-zoom enabled, animates to fit direct default-slot element boxes.
Methods
animateTo(target: Partial<ViewportTransform>, options?: ViewportAnimationOptions): void
Animates the viewport to the requested partial transform.
fitContents(options?: ViewportRevealOptions): void
Fits the union of direct default-slot element boxes within the viewport.
getTransform(): ViewportTransform
Returns the current content-space origin and CSS-pixel scale.
getVisibleRect(): ViewportRect
Returns the visible content-space rectangle.
reveal(region: { x: number; y: number; width?: number; height?: number }, options?: ViewportRevealOptions): void
Centers or fits a content-space region within the viewport.
toContentCoords(viewportX: number, viewportY: number): ViewportPoint
Converts a viewport CSS-pixel point to content space.
toViewportCoords(contentX: number, contentY: number): ViewportPoint
Converts a content-space point to viewport CSS pixels.