Interface ITransformMutators
apply(that: IReadonlyTransform, constrain: boolean): void;
clearNearFarZOverride(): void;
clone(): ITransform;
interpolatePadding(
start: PaddingOptions,
target: PaddingOptions,
t: number,
): void;
overrideNearFarZ(nearZ: number, farZ: number): void;
populateCache(coords: OverscaledTileID[]): void;
recalculateZoomAndCenter(terrain?: Terrain): void;
resize(width: number, height: number, constrainTransform: boolean): void;
setBearing(bearing: number): void;
setCenter(center: LngLat): void;
setConstrainOverride(constrain?: TransformConstrainFunction | null): void;
setElevation(elevation: number): void;
setFov(fov: number): void;
setLocationAtPoint(lnglat: LngLat, point: Point): void;
setMaxBounds(bounds?: LngLatBounds | null): void;
setMaxPitch(pitch: number): void;
setMaxZoom(zoom: number): void;
setMinElevationForCurrentTile(elevation: number): void;
setMinPitch(pitch: number): void;
setMinZoom(zoom: number): void;
setPadding(padding: PaddingOptions): void;
setPitch(pitch: number): void;
setRenderWorldCopies(renderWorldCopies: boolean): void;
setRoll(roll: number): void;
setTransitionState(value: number, error: number): void;
setZoom(zoom: number): void;
}
Hierarchy (View Summary)
- ITransformMutators
Index
Methods
Methods
apply
Parameters
- that: IReadonlyTransform
The transform to apply to the current transform.
- constrain: boolean
Whether to constrain the transform's center and zoom and recompute internal matrices once applied.
Returns void
- that: IReadonlyTransform
clearNearFarZOverride
Resets near and far Z plane override. Sets
autoCalculateNearFarZto true.Returns void
clone
Returns ITransform
interpolatePadding
Helper method to update edge-insets in place
Parameters
- start: PaddingOptions
the starting padding
- target: PaddingOptions
the target padding
- t: number
the step/weight
Returns void
- start: PaddingOptions
overrideNearFarZ
Sets the overriding values to use for near and far Z instead of what the transform would normally compute. If set to undefined, the transform will compute its ideal values. Calling this will set
autoCalculateNearFarZto false.Parameters
- nearZ: number
- farZ: number
Returns void
populateCache
Parameters
- coords: OverscaledTileID[]
Array of tile IDs that will be rendered.
Returns void
- coords: OverscaledTileID[]
recalculateZoomAndCenter
This method works in combination with freezeElevation activated. freezeElevation is enabled during map-panning because during this the camera should sit in constant height. After panning finished, call this method to recalculate the zoom level and center point for the current camera-height in current terrain.
Parameters
Optionalterrain: Terrainthe terrain
Returns void
resize
Sets the transform's width and height and recomputes internal matrices.
Parameters
- width: number
- height: number
- constrainTransform: boolean
Returns void
setBearing
Sets the transform's bearing, in degrees. Recomputes internal matrices if needed.
Parameters
- bearing: number
Returns void
setCenter
Sets the transform's center. Automatically constrains the transform's center and zoom and recomputes internal matrices if needed.
Parameters
- center: LngLat
Returns void
setConstrainOverride
Sets or clears the custom callback overriding the transform's default constrain, whose responsibility is to respect the longitude and latitude bounds by constraining the viewport's lnglat and zoom.
Parameters
Optionalconstrain: TransformConstrainFunction | nullA TransformConstrainFunction callback defining how the viewport should respect the bounds.
Returns void
setElevation
Parameters
- elevation: number
Returns void
setFov
Sets the transform's vertical field of view, in degrees. Recomputes internal matrices if needed.
Parameters
- fov: number
Returns void
setLocationAtPoint
setMaxBounds
Sets or clears the map's geographical constraints.
Parameters
Optionalbounds: LngLatBounds | nullA LngLatBounds object describing the new geographic boundaries of the map.
Returns void
setMaxPitch
Sets the transform's maximal allowed pitch, in degrees. Automatically constrains the transform's pitch to the new range and recomputes internal matrices if needed.
Parameters
- pitch: number
Returns void
setMaxZoom
Sets the transform's maximal allowed zoom level. Automatically constrains the transform's zoom to the new range and recomputes internal matrices if needed.
Parameters
- zoom: number
Returns void
setMinElevationForCurrentTile
Parameters
- elevation: number
Returns void
setMinPitch
Sets the transform's minimal allowed pitch, in degrees. Automatically constrains the transform's pitch to the new range and recomputes internal matrices if needed.
Parameters
- pitch: number
Returns void
setMinZoom
Sets the transform's minimal allowed zoom level. Automatically constrains the transform's zoom to the new range and recomputes internal matrices if needed.
Parameters
- zoom: number
Returns void
setPadding
Parameters
- padding: PaddingOptions
Returns void
setPitch
Sets the transform's pitch, in degrees. Recomputes internal matrices if needed.
Parameters
- pitch: number
Returns void
setRenderWorldCopies
Parameters
- renderWorldCopies: boolean
Returns void
setRoll
Sets the transform's roll, in degrees. Recomputes internal matrices if needed.
Parameters
- roll: number
Returns void
setTransitionState
setZoom
Sets the transform's zoom. Automatically constrains the transform's center and zoom and recomputes internal matrices if needed.
Parameters
- zoom: number
Returns void
Applies a transform to the current transform.