跳到主要内容

flywave-mapview.mapviewutils.constraintargetanddistancetoviewbounds

Home > @flywave/flywave-mapview > MapViewUtils > constrainTargetAndDistanceToViewBounds

MapViewUtils.constrainTargetAndDistanceToViewBounds() function

Constrains given camera target and distance to .

Signature:

function constrainTargetAndDistanceToViewBounds(target: THREE.Vector3, distance: number, mapView: MapView): {
target: THREE.Vector3;
distance: number;
};

Parameters

Parameter

Type

Description

target

THREE.Vector3

The camera target.

distance

number

The camera distance.

mapView

MapView

The map view whose maximum bounds will be used as constraints.

Returns:



{ target: THREE.Vector3; distance: number; }

constrained target and distance, or the unchanged input arguments if the view does not have maximum bounds set.

## Remarks

The resulting target and distance will keep the view within the maximum bounds for a camera with tilt and yaw set to 0.