fitScreenCoordinates method

MapboxMap fitScreenCoordinates(
  1. Point p0,
  2. Point p1,
  3. num bearing,
  4. [dynamic options,
  5. dynamic eventData]
)

Pans, rotates and zooms the map to to fit the box made by points p0 and p1 once the map is rotated to the specified bearing. To zoom without rotating, pass in the current map bearing.

@memberof MapboxMap# @param p0 First point on screen, in pixel coordinates @param p1 Second point on screen, in pixel coordinates @param bearing Desired map bearing at end of animation, in degrees @param options @param {number | PaddingOptions} options.padding The amount of padding in pixels to add to the given bounds. @param {boolean} options.linear=false If true, the map transitions using {@link MapboxMap#easeTo}. If false, the map transitions using {@link MapboxMap#flyTo}. See those functions and {@link AnimationOptions} for information about options available. @param {Function} options.easing An easing function for the animated transition. See {@link AnimationOptions}. @param {PointLike} options.offset=[0, 0] The center of the given bounds relative to the map's center, measured in pixels. @param {number} options.maxZoom The maximum zoom level to allow when the map view transitions to the specified bounds. @param eventData Additional properties to be added to event objects of events triggered by this method. @fires movestart @fires moveend @returns {MapboxMap} this @example var p0 = 220, 400; var p1 = 500, 900; map.fitScreenCoordinates(p0, p1, map.getBearing(), { padding: {top: 10, bottom:25, left: 15, right: 5} }); @see Used by BoxZoomHandler

Implementation

MapboxMap fitScreenCoordinates(Point p0, Point p1, num bearing,
        [dynamic options, dynamic eventData]) =>
    MapboxMap.fromJsObject(
        jsObject.fitScreenCoordinates(p0.jsObject, p1.jsObject, bearing));