On this page

Interface ITransformMutators

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)

Index

Methods

  • Applies a transform to the current transform.

    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

  • Resets near and far Z plane override. Sets autoCalculateNearFarZ to true.

    Returns void

  • Helper method to update edge-insets in place

    Parameters

    Returns void

  • 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 autoCalculateNearFarZ to false.

    Parameters

    • nearZ: number
    • farZ: number

    Returns void

  • Parameters

    Returns void

    Called before rendering to allow the transform implementation to precompute data needed to render the given tiles. Used in mercator transform to precompute tile matrices (posMatrix).

  • 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: Terrain

      the terrain

    Returns void

  • Sets the transform's width and height and recomputes internal matrices.

    Parameters

    • width: number
    • height: number
    • constrainTransform: boolean

    Returns void

  • Sets the transform's bearing, in degrees. Recomputes internal matrices if needed.

    Parameters

    • bearing: number

    Returns void

  • Sets the transform's center. Automatically constrains the transform's center and zoom and recomputes internal matrices if needed.

    Parameters

    Returns void

  • 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

    Returns void

  • Parameters

    • elevation: number

    Returns void

  • Sets the transform's vertical field of view, in degrees. Recomputes internal matrices if needed.

    Parameters

    • fov: number

    Returns void

  • Set's the transform's center so that the given point on screen is at the given world coordinates.

    Parameters

    • lnglat: LngLat

      Desired world coordinates of the point.

    • point: Point

      The screen point that should lie at the given coordinates.

    Returns void

  • Sets or clears the map's geographical constraints.

    Parameters

    Returns void

  • 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

  • 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

  • Parameters

    • elevation: number

    Returns void

  • 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

  • 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

  • Sets the transform's pitch, in degrees. Recomputes internal matrices if needed.

    Parameters

    • pitch: number

    Returns void

  • Parameters

    • renderWorldCopies: boolean

    Returns void

  • Sets the transform's roll, in degrees. Recomputes internal matrices if needed.

    Parameters

    • roll: number

    Returns void

  • Parameters

    • value: number

      The transition state value.

    • error: number

      The error value.

    Returns void

    Sets the transform's transition state from one projection to another.

  • Sets the transform's zoom. Automatically constrains the transform's center and zoom and recomputes internal matrices if needed.

    Parameters

    • zoom: number

    Returns void

Was this helpful?
SDK JS
Reference
ITransformMutators