Skip to content

Commit

Permalink
Merge branch 'master' into bounds
Browse files Browse the repository at this point in the history
  • Loading branch information
tadiseshan authored Aug 18, 2018
2 parents d849773 + c582e64 commit 3bae816
Show file tree
Hide file tree
Showing 424 changed files with 9,360 additions and 4,620 deletions.
8 changes: 1 addition & 7 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,12 @@
],
"parser": "babel-eslint",
"parserOptions": {
"sourceType": "script"
"sourceType": "module"
},
"plugins": [
"flowtype",
"import"
],
"settings": {
"import/ignore": [
"@mapbox/shelf-pack",
"@mapbox/whoots-js"
]
},
"rules": {
"array-bracket-spacing": "off",
"block-scoped-var": "error",
Expand Down
5 changes: 4 additions & 1 deletion .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@
.*/node_modules/htmltojsx/.*
.*/node_modules/documentation/.*
.*/node_modules/module-deps/.*
.*/node_modules/bcryptjs/.*
.*/node_modules/@mapbox/geojson-types/fixtures/.*
.*/test/unit/style-spec/fixture/invalidjson.input.json
.*/test/integration/render-tests/.*
.*/test/build/downstream-flow-fixture/.*

[version]
0.69.0
0.77.0
2 changes: 2 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

<!-- Thanks for the PR! Feel free to add or remove items from the checklist. -->

<!-- If your PR affects documentation relevant to the currently released version, please use `mb-pages` as the base branch. See https://github.com/mapbox/mapbox-gl-js/blob/master/docs/README.md#committing-and-publishing-documentation -->

- [ ] briefly describe the changes in this PR
- [ ] write tests for all new functionality
- [ ] document any changes to public APIs
Expand Down
2 changes: 1 addition & 1 deletion .topissuesrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"labels": {
"release blocker :no_entry:": 25,
"high priority :exclamation:": 7,
"high priority": 7,
"medium priority": 5,
"bug :beetle:": 2
}
Expand Down
30 changes: 26 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,33 @@
## 0.47.0

### ⚠️ Breaking changes
## 0.48.0

### ✨ Features and improvements
* Add `Map#fitScreenCoordinates`: fits viewport to two points, similar to `Map#fitBounds` but uses screen coordinates and supports non-zero map bearings. ([#6894](https://github.com/mapbox/mapbox-gl-js/pull/6894))

### 🐛 Bug fixes
## 0.47.0

## ✨ Features and improvements
* Add configurable drag pan threshold ([#6809](https://github.com/mapbox/mapbox-gl-js/pull/6809)) (h/t [msbarry](https://github.com/msbarry))
* Add `raster-resampling` raster paint property ([#6411](https://github.com/mapbox/mapbox-gl-js/pull/6411)) (h/t [andrewharvey](https://github.com/andrewharvey))
* Add `symbol-placement: line-center` ([#6821](https://github.com/mapbox/mapbox-gl-js/pull/6821))
* Add methods for inspecting GeoJSON clusters ([#3318](https://github.com/mapbox/mapbox-gl-js/issues/3318), fixed by [#6829](https://github.com/mapbox/mapbox-gl-js/pull/6829))
* Add warning to geolocate control when unsupported ([#6923](https://github.com/mapbox/mapbox-gl-js/pull/6923)) (h/t [aendrew](https://github.com/aendrew))
* Upgrade geojson-vt to 3.1.4 ([#6942](https://github.com/mapbox/mapbox-gl-js/pull/6942))
* Include link to license in compiled bundle ([#6975](https://github.com/mapbox/mapbox-gl-js/pull/6975))

## 🐛 Bug fixes
* Use updateData instead of re-creating buffers for repopulated paint arrays ([#6853](https://github.com/mapbox/mapbox-gl-js/pull/6853))
* Fix ScrollZoom handler setting tr.zoom = NaN ([#6924](https://github.com/mapbox/mapbox-gl-js/pull/6924))
- Failed to invert matrix error ([#6486](https://github.com/mapbox/mapbox-gl-js/issues/6486), fixed by [#6924](https://github.com/mapbox/mapbox-gl-js/pull/6924))
- Fixing matrix errors ([#6782](https://github.com/mapbox/mapbox-gl-js/issues/6782), fixed by [#6924](https://github.com/mapbox/mapbox-gl-js/pull/6924))
* Fix heatmap tile clipping when layers are ordered above it ([#6806](https://github.com/mapbox/mapbox-gl-js/issues/6806), fixed by [#6807](https://github.com/mapbox/mapbox-gl-js/pull/6807))
* Fix video source in safari (macOS and iOS) ([#6443](https://github.com/mapbox/mapbox-gl-js/issues/6443), fixed by [#6811](https://github.com/mapbox/mapbox-gl-js/pull/6811))
* Do not reload errored tiles ([#6813](https://github.com/mapbox/mapbox-gl-js/pull/6813))
* Fix send / remove timing bug in Dispatcher ([#6756](https://github.com/mapbox/mapbox-gl-js/pull/6756), fixed by [#6826](https://github.com/mapbox/mapbox-gl-js/pull/6826))
* Fix flyTo not zooming to exact given zoom ([#6828](https://github.com/mapbox/mapbox-gl-js/pull/6828))
* Don't stop animation on map resize ([#6636](https://github.com/mapbox/mapbox-gl-js/pull/6636))
* Fix map.getBounds() with rotated map ([#6875](https://github.com/mapbox/mapbox-gl-js/pull/6875)) (h/t [zoltan-mihalyi](https://github.com/zoltan-mihalyi))
* Support collators in feature filter expressions. ([#6929](https://github.com/mapbox/mapbox-gl-js/pull/6929))
* Fix Webpack production mode compatibility ([#6981](https://github.com/mapbox/mapbox-gl-js/pull/6981))

## 0.46.0

Expand Down
4 changes: 2 additions & 2 deletions batfish.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ module.exports = () => {

// Local builds treat the `dist` directory as static assets, allowing you to test examples against the
// local branch build. Non-local builds ignore the `dist` directory, and examples load assets from the CDN.
config.unprocessedPageFiles = ['dist/**/*.*'];
config.unprocessedPageFiles = ['**/dist/**/*.*'];
if (process.env.DEPLOY_ENV !== 'local') {
config.ignoreWithinPagesDirectory.push('dist/**/*.*');
config.ignoreWithinPagesDirectory.push('**/dist/**/*.*');
}

return config;
Expand Down
1 change: 0 additions & 1 deletion bench/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"parserOptions": {
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
Expand Down
2 changes: 2 additions & 0 deletions bench/benchmarks.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ function register(Benchmark) {

import Layout from './benchmarks/layout';
import LayoutDDS from './benchmarks/layout_dds';
import WorkerTransfer from './benchmarks/worker_transfer';
import Paint from './benchmarks/paint';
import PaintStates from './benchmarks/paint_states';
import LayerBenchmarks from './benchmarks/layers';
Expand All @@ -31,6 +32,7 @@ import FilterEvaluate from './benchmarks/filter_evaluate';

register(Layout);
register(LayoutDDS);
register(WorkerTransfer);
register(Paint);
register(PaintStates);
LayerBenchmarks.forEach(register);
Expand Down
129 changes: 20 additions & 109 deletions bench/benchmarks/layout.js
Original file line number Diff line number Diff line change
@@ -1,133 +1,44 @@
// @flow

import Benchmark from '../lib/benchmark';

import createStyle from '../lib/create_style';
import VT from '@mapbox/vector-tile';
import Protobuf from 'pbf';
import assert from 'assert';
import promisify from 'pify';
import WorkerTile from '../../src/source/worker_tile';
import StyleLayerIndex from '../../src/style/style_layer_index';
import deref from '../../src/style-spec/deref';
import fetchStyle from '../lib/fetch_style';
import TileParser from '../lib/tile_parser';
import { OverscaledTileID } from '../../src/source/tile_id';
import { normalizeStyleURL, normalizeSourceURL, normalizeTileURL } from '../../src/util/mapbox';

import type {TileJSON} from '../../src/types/tilejson';

// Note: this class is extended in turn by the LayoutDDS benchmark.
export default class Layout extends Benchmark {
glyphs: Object;
icons: Object;
workerTile: WorkerTile;
layerIndex: StyleLayerIndex;
tiles: Array<{tileID: OverscaledTileID, buffer: ArrayBuffer}>;
parser: TileParser;

tileIDs(): Array<OverscaledTileID> {
return [
setup(): Promise<void> {
const tileIDs = [
new OverscaledTileID(12, 0, 12, 655, 1583),
new OverscaledTileID(8, 0, 8, 40, 98),
new OverscaledTileID(4, 0, 4, 3, 6),
new OverscaledTileID(0, 0, 0, 0, 0)
];
}

sourceID(): string {
return 'composite';
}

fetchStyle(): Promise<StyleSpecification> {
return fetch(normalizeStyleURL(`mapbox://styles/mapbox/streets-v9`))
.then(response => response.json());
}

fetchTiles(styleJSON: StyleSpecification): Promise<Array<{tileID: OverscaledTileID, buffer: ArrayBuffer}>> {
const sourceURL: string = (styleJSON.sources[this.sourceID()]: any).url;
return fetch(normalizeSourceURL(sourceURL))
.then(response => response.json())
.then((tileJSON: TileJSON) => {
return Promise.all(this.tileIDs().map(tileID => {
return fetch((normalizeTileURL(tileID.canonical.url(tileJSON.tiles))))
.then(response => response.arrayBuffer())
.then(buffer => ({tileID, buffer}));
}));
});
}

setup(): Promise<void> {
return this.fetchStyle()
return fetchStyle(`mapbox://styles/mapbox/streets-v9`)
.then((styleJSON) => {
this.layerIndex = new StyleLayerIndex(deref(styleJSON.layers));
return Promise.all([createStyle(styleJSON), this.fetchTiles(styleJSON)]);
this.parser = new TileParser(styleJSON, 'composite');
return this.parser.setup();
})
.then(([style, tiles]) => {
.then(() => {
return Promise.all(tileIDs.map(tileID => this.parser.fetchTile(tileID)));
})
.then((tiles) => {
this.tiles = tiles;
this.glyphs = {};
this.icons = {};

const preloadGlyphs = (params, callback) => {
style.getGlyphs('', params, (err, glyphs) => {
this.glyphs[JSON.stringify(params)] = glyphs;
callback(err, glyphs);
});
};

const preloadImages = (params, callback) => {
style.getImages('', params, (err, icons) => {
this.icons[JSON.stringify(params)] = icons;
callback(err, icons);
});
};

return this.bench(preloadGlyphs, preloadImages);
});
// parse tiles once to populate glyph/icon cache
return Promise.all(tiles.map(tile => this.parser.parseTile(tile)));
})
.then(() => {});
}

bench(getGlyphs: Function = (params, callback) => callback(null, this.glyphs[JSON.stringify(params)]),
getImages: Function = (params, callback) => callback(null, this.icons[JSON.stringify(params)])) {

const actor = {
send(action, params, callback) {
setTimeout(() => {
if (action === 'getImages') {
getImages(params, callback);
} else if (action === 'getGlyphs') {
getGlyphs(params, callback);
} else assert(false);
}, 0);
}
};

let promise: Promise<void> = Promise.resolve();

for (const {tileID, buffer} of this.tiles) {
bench() {
let promise = Promise.resolve();
for (const tile of this.tiles) {
promise = promise.then(() => {
const workerTile = new WorkerTile({
tileID: tileID,
zoom: tileID.overscaledZ,
tileSize: 512,
overscaling: 1,
showCollisionBoxes: false,
source: this.sourceID(),
uid: '0',
maxZoom: 22,
pixelRatio: 1,
request: {
url: ''
},
angle: 0,
pitch: 0,
cameraToCenterDistance: 0,
cameraToTileDistance: 0
});

const tile = new VT.VectorTile(new Protobuf(buffer));
const parse = promisify(workerTile.parse.bind(workerTile));

return parse(tile, this.layerIndex, actor);
return this.parser.parseTile(tile).then(() => {});
});
}

return promise;
}
}
49 changes: 33 additions & 16 deletions bench/benchmarks/layout_dds.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
// @flow

import Layout from './layout';

import Benchmark from '../lib/benchmark';
import TileParser from '../lib/tile_parser';
import { OverscaledTileID } from '../../src/source/tile_id';

const LAYER_COUNT = 2;

export default class LayoutDDS extends Layout {
tileIDs(): Array<OverscaledTileID> {
return [
export default class LayoutDDS extends Benchmark {
tiles: Array<{tileID: OverscaledTileID, buffer: ArrayBuffer}>;
parser: TileParser;

setup(): Promise<void> {
const tileIDs = [
new OverscaledTileID(15, 0, 15, 9373, 12535)
];
}

sourceID(): string {
return 'mapbox';
}

fetchStyle(): Promise<StyleSpecification> {
const style = {
const styleJSON = {
"version": 8,
"sources": {
"mapbox": { "type": "vector", "url": "mapbox://mapbox.mapbox-streets-v7" }
Expand Down Expand Up @@ -83,14 +80,34 @@ export default class LayoutDDS extends Layout {
}
];

while (style.layers.length < LAYER_COUNT) {
while (styleJSON.layers.length < LAYER_COUNT) {
for (const layer of layers) {
style.layers.push(Object.assign(({}: any), layer, {
id: layer.id + style.layers.length
styleJSON.layers.push(Object.assign(({}: any), layer, {
id: layer.id + styleJSON.layers.length
}));
}
}

return Promise.resolve(style);
this.parser = new TileParser(styleJSON, 'mapbox');
return this.parser.setup()
.then(() => {
return Promise.all(tileIDs.map(tileID => this.parser.fetchTile(tileID)));
})
.then((tiles) => {
this.tiles = tiles;
// parse tiles once to populate glyph/icon cache
return Promise.all(tiles.map(tile => this.parser.parseTile(tile)));
})
.then(() => {});
}

bench() {
let promise = Promise.resolve();
for (const tile of this.tiles) {
promise = promise.then(() => {
return this.parser.parseTile(tile).then(() => {});
});
}
return promise;
}
}
Loading

0 comments on commit 3bae816

Please sign in to comment.