Skip to content

Commit

Permalink
Merge branch 'master' of github.com:mapbox/mapbox-gl-js into empty-style
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/ui/map.js
  • Loading branch information
Arindam Bose committed Dec 18, 2019
2 parents 8a7524c + 63a683f commit 2ba9f43
Show file tree
Hide file tree
Showing 278 changed files with 11,366 additions and 2,725 deletions.
29 changes: 27 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
},
"plugins": [
"flowtype",
"import"
"import",
"jsdoc"
],
"rules": {
// temporarily disabled due to https://github.com/babel/babel-eslint/issues/485
Expand Down Expand Up @@ -73,8 +74,32 @@
}],
"no-multiple-empty-lines": [ "error", {
"max": 1
}]
}],
"jsdoc/check-param-names": "warn",
"jsdoc/require-param": "warn",
"jsdoc/require-param-description": "warn",
"jsdoc/require-param-name": "warn",
"jsdoc/require-returns": "warn",
"jsdoc/require-returns-description": "warn"
},
"settings": {
"jsdoc":{
"ignorePrivate": true
}
},
"overrides": [
{
"files": ["debug/**", "bench/**", "test/**", "src/style-spec/**"],
"rules": {
"jsdoc/check-param-names": "off",
"jsdoc/require-param": "off",
"jsdoc/require-param-description": "off",
"jsdoc/require-param-name": "off",
"jsdoc/require-returns": "off",
"jsdoc/require-returns-description": "off"
}
}
],
"globals": {
"performance": true
},
Expand Down
4 changes: 3 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@
- [ ] document any changes to public APIs
- [ ] post benchmark scores
- [ ] manually test the debug page
- [ ] tagged `@mapbox/studio` and/or `@mapbox/maps-design` if this PR includes style spec or visual changes
- [ ] tagged `@mapbox/studio` and/or `@mapbox/map-design-team` if this PR includes style spec or visual changes
- [ ] tagged `@mapbox/gl-native` if this PR includes shader changes or needs a native port
- [ ] apply changelog label ('bug', 'feature', 'docs', etc) or use the label 'skip changelog'
- [ ] `<changelog>...</changelog>`
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ _site
yarn-error.log
yarn-debug.log
npm-debug.log
.idea
5 changes: 4 additions & 1 deletion .stylelintrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
"declaration-block-semicolon-newline-after": "always-multi-line",
"block-opening-brace-space-before": "always-multi-line",
"declaration-block-single-line-max-declarations": 3,
"selector-class-pattern": "mapboxgl-[a-z-]+"
"selector-class-pattern": "mapboxgl-[a-z-]+",
"at-rule-no-unknown": [true, {
"ignoreAtRules": ["svg-load"]
}]
}
}
44 changes: 44 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,47 @@
## 1.6.0

## ✨ Features
* Add ability to insert images into text labels using an `image` expression within a `format` expression: `"text-field": ["format", "Some text", ["image", "my-image"], "some more text"]` ([#8904](https://github.com/mapbox/mapbox-gl-js/pull/8904))
* Add support for stretchable images (aka nine-part or nine-patch images). Stretchable images can be used with `icon-text-fit` to draw resized images with unstretched corners and borders. ([#8997](https://github.com/mapbox/mapbox-gl-js/pull/8997))
* Add `in` expression. It can check if a value is in an array (`["in", value, array]`) or a substring is in a string (`["in", substring, string]`) ([#8876](https://github.com/mapbox/mapbox-gl-js/pull/8876))
* Add `minPitch` and `maxPitch` map options ([#8834](https://github.com/mapbox/mapbox-gl-js/pull/8834))
* Add `rotation`, `rotationAlignment` and `pitchAlignment` options to markers ([#8836](https://github.com/mapbox/mapbox-gl-js/pull/8836)) (h/t [dburnsii](https://github.com/dburnsii))
* Add methods to Popup to manipulate container class names ([#8759](https://github.com/mapbox/mapbox-gl-js/pull/8759)) (h/t [Ashot-KR](https://github.com/Ashot-KR))
* Add configurable inertia settings for panning (h/t @aMoniker) ([#8887](https://github.com/mapbox/mapbox-gl-js/pull/8887))
* Add ability to localize UI controls ([#8095](https://github.com/mapbox/mapbox-gl-js/pull/8095)) (h/t [dmytro-gokun](https://github.com/dmytro-gokun))
* Add LatLngBounds.contains() method ([#7512](https://github.com/mapbox/mapbox-gl-js/issues/7512), fixed by [#8200](https://github.com/mapbox/mapbox-gl-js/pull/8200))
* Add option to load rtl-text-plugin lazily ([#8865](https://github.com/mapbox/mapbox-gl-js/pull/8865))
* Add `essential` parameter to AnimationOptions that can override `prefers-reduced-motion: reduce` ([#8743](https://github.com/mapbox/mapbox-gl-js/issues/8743), fixed by [#8883](https://github.com/mapbox/mapbox-gl-js/pull/8883))

## 🍏 Improvements
* Allow rendering full world smaller than 512px. To restore the previous limit call `map.setMinZoom(0)` ([#9028](https://github.com/mapbox/mapbox-gl-js/pull/9028))
* Add an es modules build for mapbox-gl-style-spec in dist/ ([#8247](https://github.com/mapbox/mapbox-gl-js/pull/8247)) (h/t [ahocevar](https://github.com/ahocevar))
* Add 'image/webp,*/*' accept header to fetch/ajax image requests when webp supported ([#8262](https://github.com/mapbox/mapbox-gl-js/pull/8262))
* Improve documentation for setStyle, getStyle, and isStyleLoaded ([#8807](https://github.com/mapbox/mapbox-gl-js/pull/8807))

## 🐞 Bug Fixes
* Fix map rendering after addImage and removeImage are used to change a used image ([#9016](https://github.com/mapbox/mapbox-gl-js/pull/9016))
* Fix visibility of controls in High Contrast mode in IE ([#8874](https://github.com/mapbox/mapbox-gl-js/pull/8874))
* Fix customizable url hash string in IE 11 ([#8990](https://github.com/mapbox/mapbox-gl-js/pull/8990)) (h/t [pakastin](https://github.com/pakastin))
* Allow expression stops up to zoom 24 instead of 22 ([#8908](https://github.com/mapbox/mapbox-gl-js/pull/8908)) (h/t [nicholas-l](https://github.com/nicholas-l))
* Fix alignment of lines in really overscaled tiles ([#9024](https://github.com/mapbox/mapbox-gl-js/pull/9024))
* Fix `Failed to execute 'shaderSource' on 'WebGLRenderingContext'` errors ([#9017](https://github.com/mapbox/mapbox-gl-js/pull/9017))
* Make expression validation fail on NaN ([#8615](https://github.com/mapbox/mapbox-gl-js/pull/8615))
* Fix setLayerZoomRange bug that caused tiles to be re-requested ([#7865](https://github.com/mapbox/mapbox-gl-js/issues/7865), fixed by [#8854](https://github.com/mapbox/mapbox-gl-js/pull/8854))
* Fix `map.showTileBoundaries` rendering ([#7314](https://github.com/mapbox/mapbox-gl-js/pull/7314))
* Fix using `generateId` in conjunction with `cluster` in a GeoJSONSource ([#8223](https://github.com/mapbox/mapbox-gl-js/issues/8223), fixed by [#8945](https://github.com/mapbox/mapbox-gl-js/pull/8945))
* Fix opening popup on a marker from keyboard ([#6835](https://github.com/mapbox/mapbox-gl-js/pull/6835))
* Fix error thrown when request aborted ([#7614](https://github.com/mapbox/mapbox-gl-js/issues/7614), fixed by [#9021](https://github.com/mapbox/mapbox-gl-js/pull/9021))
* Fix attribution control when repeatedly removing and adding it ([#9052](https://github.com/mapbox/mapbox-gl-js/pull/9052))

## 1.5.1
This patch introduces two workarounds that address longstanding issues related to unbounded memory growth in Safari, including [#8771](https://github.com/mapbox/mapbox-gl-js/issues/8771) and [#4695](https://github.com/mapbox/mapbox-gl-js/issues/4695). We’ve identified two memory leaks in Safari: one in the [CacheStorage](https://developer.mozilla.org/en-US/docs/Web/API/CacheStorage) API, addressed by [#8956](https://github.com/mapbox/mapbox-gl-js/pull/8956), and one in transferring data between web workers through [Transferables](https://developer.mozilla.org/en-US/docs/Web/API/Transferable), addressed by [#9003](https://github.com/mapbox/mapbox-gl-js/pull/9003).

## 🍏 Improvements
* Implement workaround for memory leak in Safari when using the `CacheStorage` API. ( [#8856](https://github.com/mapbox/mapbox-gl-js/pull/8956))
* Implement workaround for memory leak in Safari when using `Transferable` objects to transfer `ArrayBuffers` to WebWorkers. If GL-JS detetcts that it is running in Safari, the use of `Transferables` to transfer data to WebWorkers is disabled. ( [#9003](https://github.com/mapbox/mapbox-gl-js/pull/9003))
* Improve animation performance when using `map.setData`. ([#8913](https://github.com/mapbox/mapbox-gl-js/pull/8913)) (h/t [msbarry](https://github.com/msbarry))

## 1.5.0

## ✨ Features
Expand Down
50 changes: 50 additions & 0 deletions bench/benchmarks/hillshade_load.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// @flow

import Benchmark from '../lib/benchmark';
import createMap from '../lib/create_map';
import type {StyleSpecification} from '../../src/style-spec/types';

export default class HillshadeLoad extends Benchmark {
style: StyleSpecification;

constructor() {
super();
this.style = {
"version": 8,
"name": "Hillshade-only",
"center": [-112.81596278901452, 37.251160384573595],
"zoom": 11.560975632435424,
"bearing": 0,
"pitch": 0,
"sources": {
"mapbox://mapbox.terrain-rgb": {
"url": "mapbox://mapbox.terrain-rgb",
"type": "raster-dem",
"tileSize": 256
}
},
"layers": [
{
"id": "mapbox-terrain-rgb",
"type": "hillshade",
"source": "mapbox://mapbox.terrain-rgb",
"layout": {},
"paint": {}
}
]
};
}

bench() {
return createMap({
width: 1024,
height: 1024,
style: this.style,
stubRender: false,
showMap: true,
idle: true
}).then((map) => {
map.remove();
});
}
}
19 changes: 19 additions & 0 deletions bench/benchmarks/layers.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,3 +220,22 @@ export class LayerSymbol extends LayerBenchmark {
});
}
}

export class LayerSymbolWithIcons extends LayerBenchmark {
constructor() {
super();

this.layerStyle = Object.assign({}, style, {
layers: generateLayers({
'id': 'symbollayer',
'type': 'symbol',
'source': 'composite',
'source-layer': 'poi_label',
'layout': {
'icon-image': 'dot-11',
'text-field': ['format', ['get', 'name_en'], ['image', 'dot-11']]
}
})
});
}
}
61 changes: 61 additions & 0 deletions bench/benchmarks/placement.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// @flow

import Benchmark from '../lib/benchmark';
import createMap from '../lib/create_map';
import type Map from '../../src/ui/map';

const width = 1024;
const height = 768;

export default class Paint extends Benchmark {
style: string;
locations: Array<Object>;
maps: Array<Map>;

constructor(style: string, locations: Array<Object>) {
super();
this.style = style;
this.locations = locations;
}

setup(): Promise<void> {
return Promise.all(this.locations.map(location => {
return createMap({
zoom: location.zoom,
width,
height,
center: location.center,
style: this.style,
idle: true
});
}))
.then(maps => {
this.maps = maps;
})
.catch(error => {
console.error(error);
});
}

bench() {
for (const map of this.maps) {
const showCollisionBoxes = false;
const fadeDuration = 300;
const crossSourceCollisions = true;
const forceFullPlacement = true;

map.style._updatePlacement(
map.transform,
showCollisionBoxes,
fadeDuration,
crossSourceCollisions,
forceFullPlacement);
}
}

teardown() {
for (const map of this.maps) {
map.remove();
}
}
}
30 changes: 20 additions & 10 deletions bench/lib/create_map.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,20 @@ import Map from '../../src/ui/map';

export default function (options: any): Promise<Map> {
return new Promise((resolve, reject) => {
if (options) {
options.stubRender = options.stubRender == null ? true : options.stubRender;
options.showMap = options.showMap == null ? false : options.showMap;
}

const container = document.createElement('div');
container.style.width = `${options.width || 512}px`;
container.style.height = `${options.width || 512}px`;
container.style.height = `${options.height || 512}px`;
container.style.margin = '0 auto';
container.style.display = 'none';
container.style.display = 'block';

if (!options.showMap) {
container.style.visibility = 'hidden';
}
(document.body: any).appendChild(container);

const map = new Map(Object.assign({
Expand All @@ -17,16 +26,17 @@ export default function (options: any): Promise<Map> {
}, options));

map
.on('load', () => {
// Stub out `_rerender`; benchmarks need to be the only trigger of `_render` from here on out.
map._rerender = () => {};
.on(options.idle ? 'idle' : 'load', () => {
if (options.stubRender) {
// Stub out `_rerender`; benchmarks need to be the only trigger of `_render` from here on out.
map._rerender = () => {};

// If there's a pending rerender, cancel it.
if (map._frame) {
map._frame.cancel();
map._frame = null;
// If there's a pending rerender, cancel it.
if (map._frame) {
map._frame.cancel();
map._frame = null;
}
}

resolve(map);
})
.on('error', (e) => reject(e.error))
Expand Down
3 changes: 2 additions & 1 deletion bench/lib/tile_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ export default class TileParser {
pitch: 0,
cameraToCenterDistance: 0,
cameraToTileDistance: 0,
returnDependencies
returnDependencies,
promoteId: undefined
});

const vectorTile = new VT.VectorTile(new Protobuf(tile.buffer));
Expand Down
2 changes: 1 addition & 1 deletion bench/styles/benchmarks.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import mapboxgl from '../../src';
import accessToken from '../lib/access_token';
import locationsWithTileID from '../lib/locations_with_tile_id';
import styleBenchmarkLocations from '@mapbox/gazetteer/mapbox-streets/style-benchmark-locations.json';
import styleBenchmarkLocations from '@mapbox/gazetteer/benchmark/style-benchmark-locations.json';
import StyleLayerCreate from '../benchmarks/style_layer_create';
import Validate from '../benchmarks/style_validate';
import Layout from '../benchmarks/layout';
Expand Down
13 changes: 9 additions & 4 deletions bench/versions/benchmarks.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import mapboxgl from '../../src';
import accessToken from '../lib/access_token';
import locationsWithTileID from '../lib/locations_with_tile_id';
import styleBenchmarkLocations from '@mapbox/gazetteer/mapbox-streets/style-benchmark-locations.json';
import styleBenchmarkLocations from '@mapbox/gazetteer/benchmark/style-benchmark-locations.json';
import Layout from '../benchmarks/layout';
import Placement from '../benchmarks/placement';
import LayoutDDS from '../benchmarks/layout_dds';
import SymbolLayout from '../benchmarks/symbol_layout';
import WorkerTransfer from '../benchmarks/worker_transfer';
import Paint from '../benchmarks/paint';
import PaintStates from '../benchmarks/paint_states';
import {PropertyLevelRemove, FeatureLevelRemove, SourceLevelRemove} from '../benchmarks/remove_paint_state';
import {LayerBackground, LayerCircle, LayerFill, LayerFillExtrusion, LayerHeatmap, LayerHillshade, LayerLine, LayerRaster, LayerSymbol} from '../benchmarks/layers';
import {LayerBackground, LayerCircle, LayerFill, LayerFillExtrusion, LayerHeatmap, LayerHillshade, LayerLine, LayerRaster, LayerSymbol, LayerSymbolWithIcons} from '../benchmarks/layers';
import Load from '../benchmarks/map_load';
import HillshadeLoad from '../benchmarks/hillshade_load';
import Validate from '../benchmarks/style_validate';
import StyleLayerCreate from '../benchmarks/style_layer_create';
import QueryPoint from '../benchmarks/query_point';
Expand All @@ -29,9 +31,9 @@ window.mapboxglBenchmarks = window.mapboxglBenchmarks || {};

const version = process.env.BENCHMARK_VERSION;

function register(name, benchmark) {
function register(name, bench) {
window.mapboxglBenchmarks[name] = window.mapboxglBenchmarks[name] || {};
window.mapboxglBenchmarks[name][version] = benchmark;
window.mapboxglBenchmarks[name][version] = bench;
}

const style = 'mapbox://styles/mapbox/streets-v10';
Expand All @@ -43,6 +45,7 @@ register('Paint', new Paint(style, locations));
register('QueryPoint', new QueryPoint(style, locations));
register('QueryBox', new QueryBox(style, locations));
register('Layout', new Layout(style));
register('Placement', new Placement(style, locations));
register('Validate', new Validate(style));
register('StyleLayerCreate', new StyleLayerCreate(style));
register('FunctionCreate', new FunctionCreate(style));
Expand All @@ -63,11 +66,13 @@ register('LayerHillshade', new LayerHillshade());
register('LayerLine', new LayerLine());
register('LayerRaster', new LayerRaster());
register('LayerSymbol', new LayerSymbol());
register('LayerSymbolWithIcons', new LayerSymbolWithIcons());
register('Load', new Load());
register('LayoutDDS', new LayoutDDS());
register('SymbolLayout', new SymbolLayout(style, styleLocations.map(location => location.tileID[0])));
register('FilterCreate', new FilterCreate());
register('FilterEvaluate', new FilterEvaluate());
register('HillshadeLoad', new HillshadeLoad());

Promise.resolve().then(() => {
// Ensure the global worker pool is never drained. Browsers have resource limits
Expand Down
4 changes: 2 additions & 2 deletions bench/versions/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
const params = new URLSearchParams(location.search.slice(1));
Promise.resolve(params.has('compare') ?
params.getAll('compare').filter(Boolean) :
fetch('/package.json')
fetch('https://api.github.com/repos/mapbox/mapbox-gl-js/releases/latest')
.then(response => response.json())
.then(pkg => [`v${pkg.version}`, 'master']))
.then(pkg => [pkg['tag_name'], 'master']))
.then(versions => {
return versions
.map(v => `https://s3.amazonaws.com/mapbox-gl-js/${v}/benchmarks.js`)
Expand Down
2 changes: 2 additions & 0 deletions build/generate-flow-typed-style-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ export type FormattedSpecification = string;
export type ResolvedImageSpecification = string;
export type PromoteIdSpecification = {[string]: string} | string;
export type FilterSpecification =
| ['has', string]
| ['!has', string]
Expand Down
Loading

0 comments on commit 2ba9f43

Please sign in to comment.