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

Sync v3.1.2 release to the main branch #13063

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
## 3.1.2

### Bug fixes 🐞

- Fix attribution not being displayed for imported fragments (reintroducing the fix from v3.0.1 that was accidentally missing in v3.1.0).

## 3.1.1

### Bug fixes 🐞

- Fix `fill-extrusions` not being displayed in alternative projections.
- Fix an issue when WebGL might randomly crash to an unrecoverable state on some mobile devices, specifically Safari on iOS.

## 3.1.0

### Features and improvements ✨
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "mapbox-gl",
"description": "A WebGL interactive maps library",
"version": "3.1.0",
"version": "3.1.2",
"main": "dist/mapbox-gl.js",
"style": "dist/mapbox-gl.css",
"license": "SEE LICENSE IN LICENSE.txt",
Expand Down
4 changes: 2 additions & 2 deletions src/data/bucket/fill_extrusion_bucket.js
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@ class FillExtrusionBucket implements Bucket {
options.featureIndex.insert(feature, bucketFeature.geometry, index, sourceLayerIndex, this.index, vertexArrayOffset);
}
this.sortBorders();
if (this.projection.name !== "globe") {
if (this.projection.name === "mercator") {
this.splitToSubtiles();
}
this.groundEffect.prepareBorderSegments();
Expand All @@ -729,7 +729,7 @@ class FillExtrusionBucket implements Bucket {
this.addFeature(feature, geometry, feature.index, canonical, imagePositions, availableImages, tileTransform, brightness);
}
this.sortBorders();
if (this.projection.name !== "globe") {
if (this.projection.name === "mercator") {
this.splitToSubtiles();
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/render/draw_fill_extrusion.js
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ function drawExtrusionTiles(painter: Painter, source: SourceCache, layer: FillEx
assert(!isGlobeProjection || bucket.layoutVertexExtBuffer);

let segments = bucket.segments;
if (!isGlobeProjection && !isShadowPass) {
if (tr.projection.name === 'mercator' && !isShadowPass) {
segments = bucket.getVisibleSegments(tile.tileID, painter.terrain, painter.transform.getFrustum(0));
if (!segments.get().length) {
continue;
Expand Down
2 changes: 1 addition & 1 deletion src/shaders/symbol_sdf.fragment.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ uniform lowp float u_device_pixel_ratio;
uniform bool u_is_text;
uniform bool u_is_halo;

flat in float v_draw_halo;
in float v_draw_halo;
in vec2 v_data0;
in vec3 v_data1;

Expand Down
2 changes: 1 addition & 1 deletion src/shaders/symbol_sdf.vertex.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ uniform vec3 u_ecef_origin;
uniform mat4 u_tile_matrix;
#endif

flat out float v_draw_halo;
out float v_draw_halo;
out vec2 v_data0;
out vec3 v_data1;

Expand Down
2 changes: 1 addition & 1 deletion src/shaders/symbol_text_and_icon.fragment.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ uniform highp float u_gamma_scale;
uniform lowp float u_device_pixel_ratio;
uniform bool u_is_halo;

flat in float v_draw_halo;
in float v_draw_halo;
in vec4 v_data0;
in vec4 v_data1;

Expand Down
2 changes: 1 addition & 1 deletion src/shaders/symbol_text_and_icon.vertex.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ uniform vec3 u_ecef_origin;
uniform mat4 u_tile_matrix;
#endif

flat out float v_draw_halo;
out float v_draw_halo;
out vec4 v_data0;
out vec4 v_data1;

Expand Down
2 changes: 1 addition & 1 deletion src/ui/control/attribution_control.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ class AttributionControl {
this.styleId = stylesheet.id;
}

const sourceCaches = this._map.style._sourceCaches;
const sourceCaches = this._map.style._mergedSourceCaches;
for (const id in sourceCaches) {
const sourceCache = sourceCaches[id];
if (sourceCache.used) {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
{
"version": 8,
"metadata": {
"test": {
"height": 256,
"operations": [
["setProjection", "albers"],
["wait"]
]
}

},
"sources": {
"geojson": {
"type": "geojson",
"data": {
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"property": 10
},
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-0.0003,
-0.0003
],
[
-0.0003,
0.0003
],
[
0.0003,
0.0003
],
[
0.0003,
-0.0003
],
[
-0.0003,
-0.0003
]
]
]
}
},
{
"type": "Feature",
"properties": {
"property": 20
},
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-0.0002,
0
],
[
0,
0.0002
],
[
0.0002,
0
],
[
0,
-0.0002
],
[
-0.0002,
0
]
]
]
}
},
{
"type": "Feature",
"properties": {
"property": 30
},
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-0.0001,
-0.0001
],
[
-0.0001,
0.0001
],
[
0.0001,
0.0001
],
[
0.0001,
-0.0001
],
[
-0.0001,
-0.0001
]
]
]
}
}
]
}
}
},
"pitch": 60,
"zoom": 18,
"layers": [
{
"id": "extrusion",
"type": "fill-extrusion",
"source": "geojson",
"paint": {
"fill-extrusion-height": 10,
"fill-extrusion-color": "#fff",
"fill-extrusion-vertical-scale": 0.5
}
}
]
}
39 changes: 39 additions & 0 deletions test/unit/ui/control/attribution.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,45 @@ test('AttributionControl hides attributions for sources that are not currently v
});
});

test('AttributionControl shows attribution from both root style and its imports', (t) => {

const map = globalCreateMap(t, {
attributionControl: false,
accessToken: 'pk.123',
style: {
version: 8,
imports: [{
id: 'streets',
url: '',
data: {
version: 8,
sources: {
'2': {type: 'geojson', data: {type: 'FeatureCollection', features: []}, attribution: 'Hello'}
},
layers: [
{id: '2', type: 'fill', source: '2'}
]
}
}],
sources: {
'1': {type: 'geojson', data: {type: 'FeatureCollection', features: []}, attribution: 'World'}
},
layers: [
{id: '1', type: 'fill', source: '1'}
],
owner: 'mapbox',
id: 'test'
}
});
const attribution = new AttributionControl();
map.addControl(attribution);

map.on('load', () => {
t.equal(attribution._innerContainer.innerHTML, 'Hello | World');
t.end();
});
});

test('AttributionControl toggles attributions for sources whose visibility changes when zooming', (t) => {
const map = createMap(t);
const attribution = new AttributionControl();
Expand Down
Loading