Skip to content
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

GL JS docs copyedits #11175

Merged
merged 10 commits into from
Oct 27, 2021
29 changes: 15 additions & 14 deletions src/ui/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ export type MapEvent =
* // Initialize the map
* const map = new mapboxgl.Map({});
* // Set an event listener that fires
* // when the pointing device leave's
* // when the pointing device leaves
* // the map's canvas.
* map.on('mouseout', () => {
* console.log('A mouseout event occurred.');
Expand Down Expand Up @@ -770,7 +770,7 @@ export type MapEvent =
* // Initialize the map
* const map = new mapboxgl.Map({});
* // Set an event listener that fires
* // when a touchstart event occurs within the map.
* // when a `touchstart` event occurs within the map.
* map.on('touchstart', () => {
* console.log('A touchstart event occurred.');
* });
Expand All @@ -788,7 +788,7 @@ export type MapEvent =
* @example
* // Initialize the map.
* const map = new mapboxgl.Map({});
* // Set an event listener that fires when a touchstart event occurs within the map.
* // Set an event listener that fires when a `touchstart` event occurs within the map.
* map.on('touchstart', () => {
* console.log('A touchstart event occurred.');
* });
Expand Down Expand Up @@ -824,7 +824,7 @@ export type MapEvent =
* @example
* // Initialize the map.
* const map = new mapboxgl.Map({});
* // Set an event listener that fires when a touchcancel event occurs within the map.
* // Set an event listener that fires when a `touchcancel` event occurs within the map.
* map.on('touchcancel', () => {
* console.log('A touchcancel event occurred.');
* });
Expand Down Expand Up @@ -923,7 +923,7 @@ export type MapEvent =
* // Initialize the map
* const map = new mapboxgl.Map({});
* // Set an event listener that fires
* // repeatedly during a "drag to pan" interaction.
* // repeatedly during a "drag to pan" interaction.
* map.on('drag', () => {
* console.log('A drag event occurred.');
* });
Expand Down Expand Up @@ -1402,7 +1402,7 @@ export type MapEvent =

/**
* Fired when any map data (style, source, tile, etc) begins loading or
* changing asyncronously. All `dataloading` events are followed by a `data`
* changing asynchronously. All `dataloading` events are followed by a `data`
* or `error` event. See {@link MapDataEvent} for more information.
*
* @event dataloading
Expand All @@ -1422,7 +1422,7 @@ export type MapEvent =
| 'dataloading'

/**
* Fired when the map's style begins loading or changing asyncronously.
* Fired when the map's style begins loading or changing asynchronously.
* All `styledataloading` events are followed by a `styledata`
* or `error` event. See {@link MapDataEvent} for more information.
*
Expand All @@ -1434,16 +1434,16 @@ export type MapEvent =
* // Initialize the map
* const map = new mapboxgl.Map({});
* // Set an event listener that fires
* // map's style begins loading or
* // changing asyncronously.
* // when the map's style begins loading or
* // changing asynchronously.
* map.on('styledataloading', () => {
* console.log('A styledataloading event occurred.');
* });
*/
| 'styledataloading'

/**
* Fired when one of the map's sources begins loading or changing asyncronously.
* Fired when one of the map's sources begins loading or changing asynchronously.
* All `sourcedataloading` events are followed by a `sourcedata` or `error` event.
* See {@link MapDataEvent} for more information.
*
Expand All @@ -1455,8 +1455,8 @@ export type MapEvent =
* // Initialize the map
* const map = new mapboxgl.Map({});
* // Set an event listener that fires
* // map's sources begin loading or
* // changing asyncronously.
* // when the map's sources begin loading or
* // changing asynchronously.
* map.on('sourcedataloading', () => {
* console.log('A sourcedataloading event occurred.');
* });
Expand All @@ -1476,7 +1476,7 @@ export type MapEvent =
* // Initialize the map
* const map = new mapboxgl.Map({});
* // Set an event listener that fires
* // an icon or pattern is missing.
* // when an icon or pattern is missing.
* map.on('styleimagemissing', () => {
* console.log('A styleimagemissing event occurred.');
* });
Expand All @@ -1493,7 +1493,7 @@ export type MapEvent =
| 'style.load'

/**
* Fired after speed index calculation is completed if speedIndexTiming option has set to true
* Fired after speed index calculation is completed if `speedIndexTiming` option has been set to `true`.
*
* @private
* @event speedindexcompleted
Expand All @@ -1504,6 +1504,7 @@ export type MapEvent =
* var map = new mapboxgl.Map({});
* map.speedIndexTiming = true;
* // Set an event listener that fires
* // after speed index calculation is completed.
* map.on('speedindexcompleted', function() {
* console.log(`speed index is ${map.speedIndexNumber}`);
* });
Expand Down
16 changes: 8 additions & 8 deletions src/ui/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ const defaultOptions = {
* Tilesets hosted with Mapbox can be style-optimized if you append `?optimize=true` to the end of your style URL, like `mapbox://styles/mapbox/streets-v11?optimize=true`.
* Learn more about style-optimized vector tiles in our [API documentation](https://www.mapbox.com/api-documentation/maps/#retrieve-tiles).
*
* @param {(boolean|string)} [options.hash=false] If `true`, the map's position (zoom, center latitude, center longitude, bearing, and pitch) will be synced with the hash fragment of the page's URL.
* @param {(boolean|string)} [options.hash=false] If `true`, the map's [position](https://docs.mapbox.com/help/glossary/camera) (zoom, center latitude, center longitude, bearing, and pitch) will be synced with the hash fragment of the page's URL.
* For example, `http://path/to/my/page.html#2.59/39.26/53.07/-24.1/60`.
* An additional string may optionally be provided to indicate a parameter-styled hash,
* for example http://path/to/my/page.html#map=2.59/39.26/53.07/-24.1/60&foo=bar, where `foo`
Expand All @@ -227,7 +227,7 @@ const defaultOptions = {
* @param {string} [options.logoPosition='bottom-left'] A string representing the position of the Mapbox wordmark on the map. Valid options are `top-left`,`top-right`, `bottom-left`, `bottom-right`.
* @param {boolean} [options.failIfMajorPerformanceCaveat=false] If `true`, map creation will fail if the performance of Mapbox GL JS would be dramatically worse than expected (a software renderer would be used).
* @param {boolean} [options.preserveDrawingBuffer=false] If `true`, the map's canvas can be exported to a PNG using `map.getCanvas().toDataURL()`. This is `false` by default as a performance optimization.
* @param {boolean} [options.antialias=false] If `true`, the gl context will be created with MSAA antialiasing, which can be useful for antialiasing custom layers. This is `false` by default as a performance optimization.
* @param {boolean} [options.antialias=false] If `true`, the gl context will be created with [MSAA antialiasing](https://en.wikipedia.org/wiki/Multisample_anti-aliasing), which can be useful for antialiasing custom layers. This is `false` by default as a performance optimization.
* @param {boolean} [options.refreshExpiredTiles=true] If `false`, the map won't attempt to re-request tiles once they expire per their HTTP `cacheControl`/`expires` headers.
* @param {LngLatBoundsLike} [options.maxBounds=null] If set, the map will be constrained to the given bounds.
* @param {boolean|Object} [options.scrollZoom=true] If `true`, the "scroll to zoom" interaction is enabled. An `Object` value is passed as options to {@link ScrollZoomHandler#enable}.
Expand All @@ -240,10 +240,10 @@ const defaultOptions = {
* @param {boolean | Object} [options.touchPitch=true] If `true`, the "drag to pitch" interaction is enabled. An `Object` value is passed as options to {@link TouchPitchHandler}.
* @param {boolean} [options.cooperativeGestures] If `true`, scroll zoom will require pressing the ctrl or ⌘ key while scrolling to zoom map, and touch pan will require using two fingers while panning to move the map. Touch pitch will require three fingers to activate if enabled.
* @param {boolean} [options.trackResize=true] If `true`, the map will automatically resize when the browser window resizes.
* @param {LngLatLike} [options.center=[0, 0]] The inital geographical centerpoint of the map. If `center` is not specified in the constructor options, Mapbox GL JS will look for it in the map's style object. If it is not specified in the style, either, it will default to `[0, 0]` Note: Mapbox GL uses longitude, latitude coordinate order (as opposed to latitude, longitude) to match GeoJSON.
* @param {number} [options.zoom=0] The initial zoom level of the map. If `zoom` is not specified in the constructor options, Mapbox GL JS will look for it in the map's style object. If it is not specified in the style, either, it will default to `0`.
* @param {number} [options.bearing=0] The initial bearing (rotation) of the map, measured in degrees counter-clockwise from north. If `bearing` is not specified in the constructor options, Mapbox GL JS will look for it in the map's style object. If it is not specified in the style, either, it will default to `0`.
* @param {number} [options.pitch=0] The initial pitch (tilt) of the map, measured in degrees away from the plane of the screen (0-85). If `pitch` is not specified in the constructor options, Mapbox GL JS will look for it in the map's style object. If it is not specified in the style, either, it will default to `0`.
* @param {LngLatLike} [options.center=[0, 0]] The initial geographical [centerpoint](https://docs.mapbox.com/help/glossary/camera#center) of the map. If `center` is not specified in the constructor options, Mapbox GL JS will look for it in the map's style object. If it is not specified in the style, either, it will default to `[0, 0]` Note: Mapbox GL uses longitude, latitude coordinate order (as opposed to latitude, longitude) to match GeoJSON.
* @param {number} [options.zoom=0] The initial [zoom](https://docs.mapbox.com/help/glossary/camera#zoom) level of the map. If `zoom` is not specified in the constructor options, Mapbox GL JS will look for it in the map's style object. If it is not specified in the style, either, it will default to `0`.
* @param {number} [options.bearing=0] The initial [bearing](https://docs.mapbox.com/help/glossary/camera#bearing) (rotation) of the map, measured in degrees counter-clockwise from north. If `bearing` is not specified in the constructor options, Mapbox GL JS will look for it in the map's style object. If it is not specified in the style, either, it will default to `0`.
* @param {number} [options.pitch=0] The initial [pitch](https://docs.mapbox.com/help/glossary/camera#pitch) (tilt) of the map, measured in degrees away from the plane of the screen (0-85). If `pitch` is not specified in the constructor options, Mapbox GL JS will look for it in the map's style object. If it is not specified in the style, either, it will default to `0`.
* @param {LngLatBoundsLike} [options.bounds=null] The initial bounds of the map. If `bounds` is specified, it overrides `center` and `zoom` constructor options.
* @param {Object} [options.fitBoundsOptions] A {@link Map#fitBounds} options object to use _only_ when fitting the initial `bounds` provided above.
* @param {boolean} [options.optimizeForTerrain=true] With terrain on, if `true`, the map will render for performance priority, which may lead to layer reordering allowing to maximize performance (layers that are draped over terrain will be drawn first, including fill, line, background, hillshade and raster). Otherwise, if set to `false`, the map will always be drawn for layer order priority.
Expand All @@ -265,7 +265,7 @@ const defaultOptions = {
* @param {boolean} [options.collectResourceTiming=false] If `true`, Resource Timing API information will be collected for requests made by GeoJSON and Vector Tile web workers (this information is normally inaccessible from the main Javascript thread). Information will be returned in a `resourceTiming` property of relevant `data` events.
* @param {number} [options.fadeDuration=300] Controls the duration of the fade-in/fade-out animation for label collisions, in milliseconds. This setting affects all symbol layers. This setting does not affect the duration of runtime styling transitions or raster tile cross-fading.
* @param {boolean} [options.crossSourceCollisions=true] If `true`, symbols from multiple sources can collide with each other during collision detection. If `false`, collision detection is run separately for the symbols in each source.
* @param {string} [options.accessToken=null] If specified, map will use this token instead of the one defined in mapboxgl.accessToken.
* @param {string} [options.accessToken=null] If specified, map will use this [token](https://docs.mapbox.com/help/glossary/access-token/) instead of the one defined in `mapboxgl.accessToken`.
* @param {Object} [options.locale=null] A patch to apply to the default localization table for UI strings such as control tooltips. The `locale` object maps namespaced UI string IDs to translated strings in the target language;
* see `src/ui/default_locale.js` for an example with all supported string IDs. The object may specify all UI strings (thereby adding support for a new translation) or only a subset of strings (thereby patching the default translation table).
* @param {boolean} [options.testMode=false] Silences errors and warnings generated due to an invalid accessToken, useful when using the library to write unit tests.
Expand Down Expand Up @@ -1583,7 +1583,7 @@ class Map extends Camera {
/**
* Updates the map's Mapbox style object with a new value.
*
* If a style is already set when this is used and the `diff` option is set to true, the map renderer will attempt to compare the given style
* If a style is already set when this is used and the `diff` option is set to `true`, the map renderer will attempt to compare the given style
* against the map's current state and perform only the changes necessary to make the map style match the desired state. Changes in sprites
* (images used for icons and patterns) and glyphs (fonts for label text) **cannot** be diffed. If the sprites or fonts used in the current
* style and the given style are different in any way, the map renderer will force a full update, removing the current style and building
Expand Down
2 changes: 1 addition & 1 deletion test/unit/source/canvas_source.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ test('CanvasSource', (t) => {

source.onAdd(map);

t.equal(source.hasTransition(), true, 'should animate initally');
t.equal(source.hasTransition(), true, 'should animate initially');

source.onRemove();

Expand Down