Skip to content

Commit

Permalink
Merge branch 'main' into docs-touch-pitch
Browse files Browse the repository at this point in the history
* main:
  Add touch pan blocker to gesture handling for touch devices (#11116)
  Address accessibility issues (#11064)
  add support for non-mercator projections (#11124)
  Image fallback expressions within paint properties (#11049)
  Replaces EPSG:4326 with OGC:CRS84 in GL JS `LngLat` doc (#11072)
  Add globe view support to heatmap shaders (#11120)
  Exclude flaky test (#11118)
  consistify YOUR_MAPBOX_ACCESS_TOKEN as placeholder string (#11113)
  Allow adding multiple layers to `map.on()` event handler (h/t @omerbn) (#11114)
  render-test-flakiness:clear worker storage (#11111)
  upgrade to supercluster v7.1.4, earcut v2.2.3, vt-pbf v3.1.3, geojson-rewind v0.5.1 (#11110)
  Added v1.13.2 changelog entry (#11108)
  One weird JSON.parse() trick (#11098)
  Fixed doc usage of map.getCenter (#11093)
  s̶y̶m̶b̶o̶l̶-̶c̶l̶i̶p̶ dynamic-filtering with `pitch` and `distance-from-camera` expressions (#10795)
  Update link to transpiling guide (#11096)
  Cherry pick 2.5.1 changelog (#11099)
  Fix an iOS15 issue where Safari tab bar interrupts panning (#11084)
  Fix conditional check for isFullscreen to accommodate Safari (#11086)
  Render tests for #11041 (#11070)
  • Loading branch information
Katy DeCorah committed Oct 20, 2021
2 parents 0da762a + 18b8a5f commit dba85e8
Show file tree
Hide file tree
Showing 239 changed files with 12,986 additions and 702 deletions.
14 changes: 5 additions & 9 deletions .circleci/config.yml
@@ -1,7 +1,7 @@
version: 2.1
orbs:
aws-cli: circleci/aws-cli@1.4.0
browser-tools: circleci/browser-tools@1.1.1
browser-tools: circleci/browser-tools@1.2.3

workflows:
version: 2
Expand Down Expand Up @@ -245,8 +245,7 @@ jobs:
steps:
- attach_workspace:
at: ~/
- browser-tools/install-chrome:
chrome-version: 91.0.4472.164
- browser-tools/install-chrome
- run: yarn run test-render
- store_test_results:
path: test/integration/render-tests
Expand All @@ -258,8 +257,7 @@ jobs:
steps:
- attach_workspace:
at: ~/
- browser-tools/install-chrome:
chrome-version: 91.0.4472.164
- browser-tools/install-chrome
- run: yarn run test-render-prod
- store_test_results:
path: test/integration/render-tests
Expand All @@ -271,8 +269,7 @@ jobs:
steps:
- attach_workspace:
at: ~/
- browser-tools/install-chrome:
chrome-version: 91.0.4472.164
- browser-tools/install-chrome
- run: yarn run test-query
- store_test_results:
path: test/integration/query-tests
Expand All @@ -299,8 +296,7 @@ jobs:
steps:
- attach_workspace:
at: ~/
- browser-tools/install-chrome:
chrome-version: 91.0.4472.164
- browser-tools/install-chrome
- run:
name: Collect performance stats
command: node bench/gl-stats.js
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,9 @@
## 2.5.1

### 🐞 Bug fixes

* Fix an iOS 15 issue where the iOS Safari tab bar interrupts touch interactions. ([#11084](https://github.com/mapbox/mapbox-gl-js/pull/11084))

## 2.5.0

### Features ✨ and improvements 🏁
Expand Down Expand Up @@ -170,6 +176,12 @@

- Run render tests in browser.

## 1.13.2

### 🐞 Bug fixes

* Backports a fix for an iOS 15 issue where the iOS Safari tab bar interrupts touch interactions. ([#11084](https://github.com/mapbox/mapbox-gl-js/pull/11084))

## 1.13.0

### ✨ Features and improvements
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Expand Up @@ -78,7 +78,7 @@ copy node_modules/headless-gl/deps/windows/dll/x64/*.dll c:\windows\system32
Start the debug server

```bash
MAPBOX_ACCESS_TOKEN={YOUR MAPBOX ACCESS TOKEN} yarn run start-debug
MAPBOX_ACCESS_TOKEN={YOUR_MAPBOX_ACCESS_TOKEN} yarn run start-debug
```

Open the debug page at [http://localhost:9966/debug](http://localhost:9966/debug)
Expand Down
4 changes: 3 additions & 1 deletion LICENSE.txt
Expand Up @@ -53,8 +53,10 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------------

Contains a portion of d3-color https://github.com/d3/d3-color
Contains a portion of d3-geo https://github.com/d3/d3-geo
Contains a portion of d3-geo-projection https://github.com/d3/d3-geo-projection

Copyright 2010-2016 Mike Bostock
Copyright 2010-2021 Mike Bostock
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
Expand Down
4 changes: 2 additions & 2 deletions bench/README.md
Expand Up @@ -7,7 +7,7 @@ Benchmarks help us catch performance regressions and improve performance.
Start the benchmark server

```bash
MAPBOX_ACCESS_TOKEN={YOUR MAPBOX ACCESS TOKEN} yarn start
MAPBOX_ACCESS_TOKEN={YOUR_MAPBOX_ACCESS_TOKEN} yarn start
```

To run all benchmarks, open [the benchmark page, `http://localhost:9966/bench/versions`](http://localhost:9966/bench/versions).
Expand All @@ -21,7 +21,7 @@ By default, the benchmark page will compare the local branch against `main` and
Start the benchmark server

```bash
MAPBOX_ACCESS_TOKEN={YOUR MAPBOX ACCESS TOKEN} MAPBOX_STYLES={YOUR STYLES HERE} yarn start
MAPBOX_ACCESS_TOKEN={YOUR_MAPBOX_ACCESS_TOKEN} MAPBOX_STYLES={YOUR STYLES HERE} yarn start
```
Note: `MAPBOX_STYLES` takes a comma-separated list of up to 3 Mapbox styles provided as a style URL or file system path (e.g. `./path/to/style.json,mapbox://styles/mapbox/streets-v10` or `mapbox://styles/mapbox/streets-v10,mapbox://styles/mapbox/streets-v9`)

Expand Down
1 change: 1 addition & 0 deletions bench/benchmarks/symbol_layout.js
Expand Up @@ -38,6 +38,7 @@ export default class SymbolLayout extends Layout {
tileResult.iconMap,
tileResult.imageAtlas.iconPositions,
false,
this.parser.style.listImages(),
tileResult.tileID.canonical,
tileResult.tileZoom);
}
Expand Down
11 changes: 9 additions & 2 deletions bench/versions/index.html
Expand Up @@ -18,9 +18,16 @@
const params = new URLSearchParams(location.search.slice(1));
Promise.resolve(params.has('compare') ?
params.getAll('compare').filter(Boolean) :
fetch('https://api.github.com/repos/mapbox/mapbox-gl-js/releases/latest')
fetch('https://api.github.com/repos/mapbox/mapbox-gl-js/releases')
.then(response => response.json())
.then(pkg => [pkg['tag_name'], 'main']))
.then(releases => {
for (const release of releases) {
if (!release.prerelease && !release['tag_name'].includes('style-spec')) {
return [release['tag_name'], 'main'];
}
}
return ['main'];
}))
.then(versions => {
return versions
.map(v => `https://s3.amazonaws.com/mapbox-gl-js/${v}/benchmarks.js`)
Expand Down
4 changes: 4 additions & 0 deletions build/generate-flow-typed-style-spec.js
Expand Up @@ -38,6 +38,8 @@ function flowType(property) {
return 'TerrainSpecification';
case 'fog':
return 'FogSpecification';
case 'projection':
return 'ProjectionSpecification';
case 'sources':
return '{[_: string]: SourceSpecification}';
case '*':
Expand Down Expand Up @@ -185,6 +187,8 @@ ${flowObjectDeclaration('TerrainSpecification', spec.terrain)}
${flowObjectDeclaration('FogSpecification', spec.fog)}
${flowObjectDeclaration('ProjectionSpecification', spec.projection)}
${spec.source.map(key => flowObjectDeclaration(flowSourceTypeName(key), spec[key])).join('\n\n')}
export type SourceSpecification =
Expand Down
9 changes: 6 additions & 3 deletions build/generate-struct-arrays.js
Expand Up @@ -118,10 +118,10 @@ function camelize (str) {
global.camelize = camelize;

import posAttributes from '../src/data/pos_attributes.js';
import rasterBoundsAttributes from '../src/data/raster_bounds_attributes.js';
import boundsAttributes from '../src/data/bounds_attributes.js';

createStructArrayType('pos', posAttributes);
createStructArrayType('raster_bounds', rasterBoundsAttributes);
createStructArrayType('raster_bounds', boundsAttributes);

import circleAttributes from '../src/data/bucket/circle_attributes.js';
import fillAttributes from '../src/data/bucket/fill_attributes.js';
Expand All @@ -130,6 +130,7 @@ import lineAttributesExt from '../src/data/bucket/line_attributes_ext.js';
import patternAttributes from '../src/data/bucket/pattern_attributes.js';
import dashAttributes from '../src/data/bucket/dash_attributes.js';
import skyboxAttributes from '../src/render/skybox_attributes.js';
import tileBoundsAttributes from '../src/data/bounds_attributes.js';
import {fillExtrusionAttributes, centroidAttributes} from '../src/data/bucket/fill_extrusion_attributes.js';

// layout vertex arrays
Expand Down Expand Up @@ -208,6 +209,9 @@ createStructArrayType('line_strip_index', createLayout([
// skybox vertex array
createStructArrayType(`skybox_vertex`, skyboxAttributes);

// tile bounds vertex array
createStructArrayType(`tile_bounds`, tileBoundsAttributes);

// paint vertex arrays

// used by SourceBinder for float properties
Expand Down Expand Up @@ -244,7 +248,6 @@ fs.writeFileSync('src/data/array_types.js',
import assert from 'assert';
import {Struct, StructArray} from '../util/struct_array.js';
import {register} from '../util/web_worker_transfer.js';
import Point from '@mapbox/point-geometry';
${layouts.map(structArrayLayoutJs).join('\n')}
${arraysWithStructAccessors.map(structArrayJs).join('\n')}
Expand Down
2 changes: 1 addition & 1 deletion build/rollup_plugin_minify_style_spec.js
Expand Up @@ -16,7 +16,7 @@ export default function minifyStyleSpec() {
delete spec['expression_name'];

return {
code: JSON.stringify(spec, replacer, 0),
code: `export default JSON.parse('${JSON.stringify(spec, replacer, 0)}');`,
map: {mappings: ''}
};
}
Expand Down
4 changes: 3 additions & 1 deletion build/rollup_plugins.js
Expand Up @@ -16,7 +16,9 @@ import replace from '@rollup/plugin-replace';
export const plugins = (minified, production, test, bench) => [
flow(),
minifyStyleSpec(),
json(),
json({
exclude: 'src/style-spec/reference/v8.json'
}),
production ? strip({
sourceMap: true,
functions: ['PerformanceUtils.*', 'WorkerPerformanceUtils.*', 'Debug.*']
Expand Down
142 changes: 142 additions & 0 deletions debug/dynamic-filter.html
@@ -0,0 +1,142 @@
<!DOCTYPE html>
<html>
<head>
<title>Mapbox GL JS debug page</title>
<meta charset='utf-8'>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<script src="https://cdn.jsdelivr.net/npm/@turf/turf@6/turf.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/gl-matrix@3.3.0/gl-matrix-min.js"></script>
<link rel='stylesheet' href='../dist/mapbox-gl.css' />
<style>
body { margin: 0; padding: 0; }
html, body, #map { height: 100%; }
#tooltip {
position: absolute;
left: 0px;
top: 0px;
background-color: white;
z-index: 5;
}
</style>
</head>

<body>
<div id='map'>
<div id='tooltip'></div>
</div>

<script src='../dist/mapbox-gl-dev.js'></script>
<script src='../debug/access_token_generated.js'></script>
<script>

/*global glMatrix, turf*/

var map = window.map = new mapboxgl.Map({
container: 'map',
zoom: 10.852,
center: [-120.30344797631889, 38.11726797649675],
style: 'mapbox://styles/mapbox/streets-v11',
// hash: true
});

function calcMercatorDistanceMatrix() {
const center = map.transform.point;

const m = new Float64Array(16);
const worldSize = map.transform.worldSize;
const windowScaleFactor = 1 / map.transform.height;
glMatrix.mat4.fromScaling(m, [windowScaleFactor, -windowScaleFactor, windowScaleFactor]);
glMatrix.mat4.rotateZ(m, m, map.transform.angle);
glMatrix.mat4.translate(m, m, [-center.x, -center.y, 0]);

return glMatrix.mat4.scale([], m, [worldSize, worldSize, 1]);
}

function generateDistanceScales() {
const center = map.getCenter();
const bearing = map.getBearing();
const numSteps = 10;
const step = 0.25;

const matrix = glMatrix.mat4.invert([], calcMercatorDistanceMatrix());
const lines = [];
for (let i = -numSteps; i <= numSteps; i++) {
const distance = step * i;
const v0 = [-2, distance, 0];
const v1 = [0, distance, 0];
const v2 = [2, distance, 0];
const p0 = new mapboxgl.MercatorCoordinate(...glMatrix.vec3.transformMat4([], v0, matrix)).toLngLat();
const p1 = new mapboxgl.MercatorCoordinate(...glMatrix.vec3.transformMat4([], v1, matrix)).toLngLat();
const p2 = new mapboxgl.MercatorCoordinate(...glMatrix.vec3.transformMat4([], v2, matrix)).toLngLat();
const line = turf.lineString([[p0.lng, p0.lat], [p1.lng, p1.lat], [p2.lng, p2.lat]], {distance: `${distance.toFixed(2)}`});
lines.push(line);
}

return turf.featureCollection(lines);
}

const tooltip = document.getElementById('tooltip');
map.on('mousemove', (e) => {
const loc = map.unproject(e.point);
const m = calcMercatorDistanceMatrix();
const {x, y, z} = mapboxgl.MercatorCoordinate.fromLngLat(loc);
const v = glMatrix.vec3.transformMat4([], [x, y, z], m);

const dist = v[1];
tooltip.innerText = dist.toFixed(2);
tooltip.style.transform = `translate(${e.point.x + 10}px,${e.point.y + 10}px)`;
});

map.once('load', () => {
map.setFilter('building-number-label',
["case",
["<", ["pitch"], 60], true,
["all", [">=", ["pitch"], 60], ["<", ["distance-from-center"], 0]], true,
false
]
);

map.addSource('rings', {
type: 'geojson',
data: {
"type": "FeatureCollection",
"features": []
}
});

map.addLayer({
type: 'line',
id: 'rings-layer',
source: 'rings',
paint: {
"line-width": 10
}
});

map.addLayer({
type: 'symbol',
id: 'rings-labels',
source: 'rings',
layout: {
"symbol-placement": 'line',
"text-field": ["get", "distance"],
"text-pitch-alignment": "viewport",
"text-allow-overlap": true
},
paint: {
"text-color": 'red',
"text-halo-color": 'white',
"text-halo-width": 2
}
});

map.on('idle', () => {
const scale = generateDistanceScales();
map.getSource('rings').setData(scale);
});

});

</script>
</body>
</html>
2 changes: 1 addition & 1 deletion debug/index.html
Expand Up @@ -22,7 +22,7 @@
container: 'map',
zoom: 12.5,
center: [-122.4194, 37.7749],
style: 'mapbox://styles/mapbox/streets-v10',
style: 'mapbox://styles/mapbox/streets-v11',
hash: true
});

Expand Down

0 comments on commit dba85e8

Please sign in to comment.