lookAtAreaWithViewRectangle static method

MapCameraUpdate lookAtAreaWithViewRectangle(
  1. GeoBox target,
  2. Rectangle2D viewRectangle
)

Creates an update to look at the given geo-box and fit it inside the given rectangle, preserving current orientation and zooming at the center of view rectangle.

If geoBox is not valid, no update will be applied to the map camera.

If the MapCameraUpdateFactory.lookAtAreaWithViewRectangle.viewRectangle parameter is invalid, fully or partially outside the map view, then the entire map viewport will be used as MapCameraUpdateFactory.lookAtAreaWithViewRectangle.viewRectangle. Thus, no padding will be applied. A MapCameraUpdateFactory.lookAtAreaWithViewRectangle.viewRectangle is considered invalid, when its width or height are negative or zero, its origin coordinates (x, y) are invalid, when they are negative.

In cases where it is not possible to find a solution for the given parameters, the resulting MapCameraUpdate will not change the map camera.

The altitude of the target points is ignored. Any subsequent camera updates and animations will consider the target point as being located on the ground.

  • target Geodetic box that should be visible inside the given view rectangle.

  • viewRectangle View rectangle in viewport pixel coordinates.

Returns MapCameraUpdate. MapCameraUpdate instance.

Implementation

static MapCameraUpdate lookAtAreaWithViewRectangle(GeoBox target, Rectangle2D viewRectangle) => $prototype.lookAtAreaWithViewRectangle(target, viewRectangle);