Skip to content

Docs sprint primary pull request #9607

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 74 commits into from
Apr 24, 2020
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
410fa94
[docsprint] Clarify meaning of Map#isSourceLoaded (#9589)
adrianababakanian Apr 20, 2020
9f18918
[docsprint] Add geolocate trigger example (#9552)
samfader Apr 20, 2020
d54cef2
[docsprint] Add inline snippet to marker#addTo (#9592)
HeyStenson Apr 20, 2020
0f7c8b9
[docsprint] Add inline snippet and related examples to popup.setHTML …
danswick Apr 20, 2020
c625efa
Add inline and related example for panTo (#9547)
Apr 20, 2020
4ed7ca8
Add inline snippet to LngLatBounds.contains (#9548)
jbranigan Apr 20, 2020
254f29f
[docsprint] Add inline snippet and examples to map.jumpTo (#9549)
jstratman Apr 20, 2020
c201f06
added inline and tutorial examples for map.getCenter (#9551)
jstratman Apr 20, 2020
74fc5ef
add example for Marker class setLngLat (#9553)
Apr 20, 2020
08c55fb
added examples to get- and setLayoutProperty (#9554)
jstratman Apr 20, 2020
10ed623
add inline snippet and examples to map.triggerRepaint (#9555)
jstratman Apr 20, 2020
6874d42
CameraOptions - update pitch and bearing definitions, add inline code…
Apr 20, 2020
a5eed0e
add inline code snippet to map.showTileBoundaries (#9557)
jstratman Apr 20, 2020
d821161
Mark Debug namespace as private to hide it from the docs (#9558)
Apr 20, 2020
f7e35a9
[docsprint] Add detail to docs on setFeatureState, removeFeatureState…
Apr 20, 2020
319c5eb
[docsprint] map.on: remove extra on section, link to event types, add…
danswick Apr 20, 2020
0f4a3f0
add examples to open and close popup events (#9565)
Apr 20, 2020
ce1e98d
[docsprint] Clarify how map.moveLayer works (#9566)
Apr 20, 2020
0711003
[doscprint] add links to EPSG and minor example changes for LngLat (#…
geografa Apr 20, 2020
d536278
document the layer object's properties in addLayer (#9571)
Apr 20, 2020
8279ca5
[docsprint] Add inline snippet and examples to popup.addTo (#9572)
jstratman Apr 20, 2020
3f39525
Add inline example for trackPointer (#9575)
Apr 20, 2020
41f52a0
Add inline example for Popup#getElement (#9576)
Apr 20, 2020
e5954f2
[docsprint] Add inline examples for Point & PointLike types (#9577)
adrianababakanian Apr 20, 2020
6b419c2
[docsprint] Cleanup doc for MapBoxZoomEvent (#9564)
Apr 20, 2020
73bc120
Describe map style object returned by Map#getStyle (#9579)
adrianababakanian Apr 20, 2020
21a7fe9
[docsprint] Add inline example for getClusterLeaves (#9580)
Apr 20, 2020
1d27338
[docsprint] PaddingOptions - update definition, example, and related …
pjleonard37 Apr 20, 2020
cde46be
[docsprint] Add inline snippet to marker#setPopup, marker#getPopup, a…
HeyStenson Apr 20, 2020
6228c72
update setFilter jsdoc (#9586)
Apr 20, 2020
ea0f47e
add more details to getSource (#9587)
Apr 20, 2020
48a3546
add clearStorage example (#9588)
Apr 20, 2020
93774c6
[docsprint] Add documentation for RequestParameters (#9573)
Apr 20, 2020
523a445
[docsprint] Add inline example for setZoomRate and setWheelZoomRate o…
Apr 20, 2020
176e092
Add inline examples for map zoom-related methods (#9594)
adrianababakanian Apr 20, 2020
e8aab02
[docsprint] Add example to MapMouseEvent (#9595)
Apr 20, 2020
4bbd7f0
Add examples for GeolocateControl events (#9596)
adrianababakanian Apr 20, 2020
b0623b8
[docsprint] Add example to MapDataEvent (#9597)
Apr 20, 2020
a55e8e8
add example for getLngLat (#9591)
dpdiliberto Apr 20, 2020
4866026
suggested edits for clarifying mouse events
colleenmcginnis Apr 16, 2020
3379e24
Small grammar fix: "optional the `layerId`" -> "the optional `layerId"
Apr 22, 2020
94217f9
Remove stray `}`; Add missing `);`
Apr 22, 2020
72a6f6f
Update src/geo/lng_lat_bounds.js
Apr 23, 2020
efff4fa
Update src/source/geojson_source.js
Apr 23, 2020
2659433
Update src/ui/camera.js
Apr 23, 2020
1cea620
Update src/ui/map.js
Apr 23, 2020
da7fbf4
Update src/util/ajax.js
Apr 23, 2020
cf16abe
Update src/ui/events.js
Apr 23, 2020
95e2773
Update src/ui/events.js
Apr 23, 2020
4cf5c75
Update src/ui/events.js
Apr 23, 2020
173196b
Update src/ui/events.js
Apr 23, 2020
05a1650
Update src/ui/map.js
Apr 23, 2020
165afe8
Update src/ui/camera.js
Apr 23, 2020
001da7b
Update src/ui/events.js
Apr 23, 2020
1c22562
Update src/ui/events.js
Apr 23, 2020
8a8d020
Update src/ui/marker.js
Apr 23, 2020
d56984a
Update src/ui/marker.js
Apr 23, 2020
35e14e9
Update src/ui/marker.js
Apr 23, 2020
b0ad7ef
Apply suggestions from code review
Apr 23, 2020
2d2597f
Update pitch param definition; add Display buildings in 3D example
Apr 23, 2020
b8a3249
whitespace adjustments
Apr 23, 2020
fc3fd85
remove example object, light formatting and copyediting
Apr 23, 2020
944a324
Apply suggestions from code review
Apr 23, 2020
14385ab
Apply suggestions from code review
Apr 23, 2020
9d4aee9
Update src/ui/camera.js
danswick Apr 23, 2020
f6285e8
Update src/ui/camera.js
danswick Apr 23, 2020
fe8ce62
Update src/ui/camera.js
danswick Apr 23, 2020
ff6bfef
Update src/ui/events.js
danswick Apr 23, 2020
b417ce0
Update src/ui/events.js
danswick Apr 23, 2020
c5923cd
Update src/util/ajax.js
danswick Apr 23, 2020
6c67225
Update src/ui/control/geolocate_control.js
danswick Apr 23, 2020
b90fcd2
Update src/ui/map.js
danswick Apr 24, 2020
ab887c4
Update src/ui/map.js
danswick Apr 24, 2020
b01e962
Fix typo in src/ui/events.js
karimnaaji Apr 24, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/geo/lng_lat.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ export const earthRadius = 6371008.8;

/**
* A `LngLat` object represents a given longitude and latitude coordinate, measured in degrees.
* These coordinates are based on the [WGS84 (EPSG:4326) standard](https://en.wikipedia.org/wiki/World_Geodetic_System#WGS84).
*
* Mapbox GL uses longitude, latitude coordinate order (as opposed to latitude, longitude) to match GeoJSON.
* Mapbox GL uses longitude, latitude coordinate order (as opposed to latitude, longitude) to match the
* [GeoJSON specification](https://tools.ietf.org/html/rfc7946).
*
* Note that any Mapbox GL method that accepts a `LngLat` object as an argument or option
* can also accept an `Array` of two numbers and will perform an implicit conversion.
Expand All @@ -22,7 +24,8 @@ export const earthRadius = 6371008.8;
* @param {number} lng Longitude, measured in degrees.
* @param {number} lat Latitude, measured in degrees.
* @example
* var ll = new mapboxgl.LngLat(-73.9749, 40.7736);
* var ll = new mapboxgl.LngLat(-123.9749, 40.7736);
* ll.lng; // = -123.9749
* @see [Get coordinates of the mouse pointer](https://www.mapbox.com/mapbox-gl-js/example/mouse-position/)
* @see [Display a popup](https://www.mapbox.com/mapbox-gl-js/example/popup/)
* @see [Highlight features within a bounding box](https://www.mapbox.com/mapbox-gl-js/example/using-box-queryrenderedfeatures/)
Expand Down
9 changes: 9 additions & 0 deletions src/geo/lng_lat_bounds.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,15 @@ class LngLatBounds {
*
* @param {LngLatLike} lnglat geographic point to check against.
* @returns {boolean} True if the point is within the bounding box.
* @example
* var llb = new mapboxgl.LngLatBounds(
* new mapboxgl.LngLat(-73.9876, 40.7661),
* new mapboxgl.LngLat(-73.9397, 40.8002)
* );
*
* var ll = new mapboxgl.LngLat(-73.9567, 40.7789);
*
* llb.contains(ll); // = true
*/
contains(lnglat: LngLatLike) {
const {lng, lat} = LngLat.convert(lnglat);
Expand Down
51 changes: 46 additions & 5 deletions src/ui/camera.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,26 @@ import type {PaddingOptions} from '../geo/edge_insets';
* @typedef {Object} CameraOptions
* @property {LngLatLike} center The desired center.
* @property {number} zoom The desired zoom level.
* @property {number} bearing The desired bearing, in degrees. The bearing is the compass direction that
* is "up"; for example, a bearing of 90° orients the map so that east is up.
* @property {number} pitch The desired pitch, in degrees.
* @property {number} bearing The desired bearing in degrees. The bearing is the compass direction that
* is "up". For example, `bearing: 90` orients the map so that east is up.
* @property {number} pitch The desired pitch in degrees. The pitch is the angle towards the horizon
* measured in degrees with a range between 0 and 60 degrees. For example, `pitch: 0` results in a two-dimensional map,
* as if your line of sight forms a perpendicular angle with the earth's surface.
* @property {LngLatLike} around If `zoom` is specified, `around` determines the point around which the zoom is centered.
* @property {PaddingOptions} padding Dimensions in pixels applied on each side of the viewport for shifting the vanishing point.
* @example
* // set the map's initial perspective with CameraOptions
* var map = new mapboxgl.Map({
* container: 'map',
* style: 'mapbox://styles/mapbox/streets-v11',
* center: [-73.5804, 45.53483],
* pitch: 60,
* bearing: -60,
* zoom: 10
* });
* @see [Set pitch and bearing](https://docs.mapbox.com/mapbox-gl-js/example/set-perspective/)
* @see [Jump to a series of locations](https://docs.mapbox.com/mapbox-gl-js/example/jump-to/)
* @see [Fly to a location](https://docs.mapbox.com/mapbox-gl-js/example/flyto/)
*/
export type CameraOptions = {
center?: LngLatLike,
Expand Down Expand Up @@ -119,6 +134,13 @@ class Camera extends Evented {
*
* @memberof Map#
* @returns The map's geographical centerpoint.
* @example
* // return a LngLat object such as {lng: 0, lat: 0} at null island
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* // return a LngLat object such as {lng: 0, lat: 0} at null island
* // Returns a LngLat object such as {lng: 0, lat: 0} at null island

* var center = map.getCenter();
* // return longitude and latitude values directly
* var longitude = map.getCenter().lng;
* var latitude = map.getCenter().lat;
* @see [Use Mapbox GL JS in a React app](https://docs.mapbox.com/help/tutorials/use-mapbox-gl-js-with-react/#store-the-new-coordinates)
*/
getCenter(): LngLat { return new LngLat(this.transform.center.lng, this.transform.center.lat); }

Expand Down Expand Up @@ -156,15 +178,21 @@ class Camera extends Evented {
}

/**
* Pans the map to the specified location, with an animated transition.
* Pans the map to the specified location with an animated transition.
*
* @memberof Map#
* @param lnglat The location to pan the map to.
* @param options Options object
* @param options Options describing the destination and animation of the transition.
* @param eventData Additional properties to be added to event objects of events triggered by this method.
* @fires movestart
* @fires moveend
* @returns {Map} `this`
* @example
* map.panTo([-74, 38]);
* @example
* // Change the duration of panTo to 5000 milliseconds.
* map.panTo([-74, 38], {duration: 5000});
* @see [Update a feature in realtime](https://docs.mapbox.com/mapbox-gl-js/example/live-update-feature/)
*/
panTo(lnglat: LngLatLike, options?: AnimationOptions, eventData?: Object) {
return this.easeTo(extend({
Expand Down Expand Up @@ -631,6 +659,19 @@ class Camera extends Evented {
* @fires zoomend
* @fires pitchend
* @returns {Map} `this`
* @example
* // jump to null island at current zoom
* map.jumpTo({center: [0, 0]});
* // jump with zoom, pitch, and bearing set
* map.jumpTo({
* center: [0, 0],
* zoom: 8,
* pitch: 45,
* bearing: 90
* }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stray bracket:

Suggested change
* }
*

* });
* @see [Jump to a series of locations](https://docs.mapbox.com/mapbox-gl-js/example/jump-to/)
* @see [Update a feature in realtime](https://docs.mapbox.com/mapbox-gl-js/example/live-update-feature/)
*/
jumpTo(options: CameraOptions, eventData?: Object) {
this.stop();
Expand Down
21 changes: 17 additions & 4 deletions src/ui/control/geolocate_control.js
Original file line number Diff line number Diff line change
Expand Up @@ -406,10 +406,23 @@ class GeolocateControl extends Evented {
}

/**
* Trigger a geolocation
*
* @returns {boolean} Returns `false` if called before control was added to a map, otherwise returns `true`.
*/
* Trigger a geolocation
*
* @returns {boolean} Returns `false` if called before control was added to a map, otherwise returns `true`.
* @example
* // Initialize the geolocate control.
* var geolocate = new mapboxgl.GeolocateControl({
* positionOptions: {
* enableHighAccuracy: true
* },
* trackUserLocation: true
* });
* // Add the control to the map.
* map.addControl(geolocate);
* map.on('load', function() {
* geolocate.trigger();
* }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing closing right parenthesis and semicolon

Suggested change
* }
* });

*/
trigger() {
if (!this._setup) {
warnOnce('Geolocate control triggered before added to a map');
Expand Down
Loading