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

Merge branch 'publisher-production' #8305

Merged
merged 29 commits into from
May 30, 2019
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
3a871e7
Set default thumbnail for examples page for development (#8025)
katydecorah Mar 21, 2019
d0649cb
v0.54.0-beta.1 (#8084)
mourner Mar 26, 2019
9dd9f00
CP removeFeatureState fix (#8090)
Mar 29, 2019
1f38321
v0.54.0 (#8115)
mourner Apr 3, 2019
797527a
Example for `fill-pattern` (#8022)
hormesiel Apr 8, 2019
0438e5e
move docs dependencies to dev (#8121) (#8129)
mourner Apr 9, 2019
6e6a005
Mapbox-gl-geocoder v4 examples (#8053)
Apr 9, 2019
2b195dc
Studio does support rtl plugin (#8135)
samanpwbb Apr 9, 2019
b32d2ce
Update comment for setRTLTextPlugin (#8143)
HeyStenson Apr 12, 2019
8af8aca
update one more frame after canvas source paused (#8130) (#8163)
mourner Apr 17, 2019
2d9001e
Bugfix - removeFeatureState fails with target.id === 0 (#8150) (#8164)
mourner Apr 17, 2019
428480a
v0.54.0-beta.2 (#8166)
mourner Apr 18, 2019
2aaab27
[docs] meta updates for search (#8142)
katydecorah Apr 22, 2019
c6e1be7
[docs] token refactor in docs-page-shell (#8174)
katydecorah Apr 23, 2019
38e555e
[docs] token refactor in docs-page-shell (#8174) (#8181)
mourner Apr 24, 2019
c3f20b3
Fix disappearing controls in Safari 12+ (#8193) (#8194)
mourner Apr 25, 2019
48dce18
v0.54.0 (take two) (#8184)
mourner Apr 25, 2019
353dc34
Merge branch 'release-liquid' into publisher-production
mourner Apr 25, 2019
b26fcc5
fix imagery endpoint on WMS example (#8203)
Apr 26, 2019
9781993
mapbox-gl-geocoder@v4.2.0 (#8212)
May 1, 2019
1493081
[docs] add trailing slash to `pathname` so resolved URL matches the c…
May 8, 2019
229b71d
Update documentation.yml (#8230)
erictheise May 8, 2019
845433b
update mapbox-gl-geocoder to v4.3.0 (#8231)
May 17, 2019
2dbd0dd
@mapbox/mapbox gl style spec@13.7.0 (#8264)
tristen May 20, 2019
0b99b23
Add sku token to Mapbox API tile requests (#14) (#8276)
ryanhamley May 22, 2019
9fcf20e
v1.0.0 (#8277)
May 22, 2019
2b4713d
Merge branch 'release-mojito' into publisher-production
May 22, 2019
b5441bc
[docs] update docs-page-shell (#8254)
May 28, 2019
509fe2a
Merge branch 'publisher-production'
May 29, 2019
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
40 changes: 40 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,43 @@
## 0.54.0

### Breaking changes

- Turned `localIdeographFontFamily` map option on by default. This may change how CJK labels are rendered, but dramatically improves performance of CJK maps (because the browser no longer needs to download heavy amounts of font data from the server). Add `localIdeographyFontFamily: false` to turn this off. [#8008](https://github.com/mapbox/mapbox-gl-js/pull/8008)
- Added `Popup` `maxWidth` option, set to `"240px"` by default. [#7906](https://github.com/mapbox/mapbox-gl-js/pull/7906)

### Major features

- Added support for updating and animating style images. [#7999](https://github.com/mapbox/mapbox-gl-js/pull/7999)
- Added support for generating style images dynamically (e.g. for drawing icons based on feature properties). [#7987](https://github.com/mapbox/mapbox-gl-js/pull/7987)
- Added antialiasing support for custom layers. [#7821](https://github.com/mapbox/mapbox-gl-js/pull/7821)
- Added a new `mapbox-gl-csp.js` bundle for strict CSP environments where `worker-src: blob` is disallowed. [#8044](https://github.com/mapbox/mapbox-gl-js/pull/8044)

### Minor features and improvements

- Improved performance of fill extrusions. [#7821](https://github.com/mapbox/mapbox-gl-js/pull/7821)
- Improved performance of symbol layers. [#7967](https://github.com/mapbox/mapbox-gl-js/pull/7967)
- Slightly improved rendering performance in general. [#7969](https://github.com/mapbox/mapbox-gl-js/pull/7969)
- Slightly improved performance of HTML markers. [#8018](https://github.com/mapbox/mapbox-gl-js/pull/8018)
- Improved diffing of styles with `"visibility": "visible"`. [#8005](https://github.com/mapbox/mapbox-gl-js/pull/8005)
- Improved zoom buttons to grey out when reaching min/max zoom. [#8023](https://github.com/mapbox/mapbox-gl-js/pull/8023)
- Added a title to fullscreen control button. [#8012](https://github.com/mapbox/mapbox-gl-js/pull/8012)
- Added `rel="noopener"` attributes to links that lead to external websites (such as Mapbox logo and OpenStreetMap edit link) for improved security. [#7914](https://github.com/mapbox/mapbox-gl-js/pull/7914)
- Added tile size info when `map.showTileBoundaries` is turned on. [#7963](https://github.com/mapbox/mapbox-gl-js/pull/7963)
- Significantly improved load times of the benchmark suite. [#8066](https://github.com/mapbox/mapbox-gl-js/pull/8066)
- Improved behavior of `canvasSource.pause` to be more reliable and able to render a single frame. [#8130](https://github.com/mapbox/mapbox-gl-js/pull/8130)

### Bug fixes

- Fixed a bug in Mac Safari 12+ where controls would disappear until you interact with the map. [8193](https://github.com/mapbox/mapbox-gl-js/pull/8193)
- Fixed a memory leak when calling `source.setData(url)` many times. [#8035](https://github.com/mapbox/mapbox-gl-js/pull/8035)
- Fixed a bug where marker lost focus when dragging. [#7799](https://github.com/mapbox/mapbox-gl-js/pull/7799)
- Fixed a bug where `map.getCenter()` returned a reference to an internal `LngLat` object instead of cloning it, leading to potential mutability bugs. [#7922](https://github.com/mapbox/mapbox-gl-js/pull/7922)
- Fixed a bug where default HTML marker positioning was slightly off. [#8074](https://github.com/mapbox/mapbox-gl-js/pull/8074)
- Fixed a bug where adding a fill extrusion layer for non-polygon layers would lead to visual artifacts. [#7685](https://github.com/mapbox/mapbox-gl-js/pull/7685)
- Fixed intermittent Flow failures on CI. [#8061](https://github.com/mapbox/mapbox-gl-js/pull/8061)
- Fixed a bug where calling `Map#removeFeatureState` does not remove the state from some tile zooms [#8087](https://github.com/mapbox/mapbox-gl-js/pull/8087)
- Fixed a bug where `removeFeatureState` didn't work on features with `id` equal to `0`. [#8150](https://github.com/mapbox/mapbox-gl-js/pull/8150)

## 0.53.1

## Bug fixes
Expand Down
10 changes: 5 additions & 5 deletions 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": "0.53.1",
"version": "0.54.0",
"main": "dist/mapbox-gl.js",
"style": "dist/mapbox-gl.css",
"license": "SEE LICENSE IN LICENSE.txt",
Expand All @@ -13,14 +13,10 @@
"node": ">=6.4.0"
},
"dependencies": {
"@mapbox/appropriate-images-react": "^1.0.0",
"@mapbox/dr-ui": "0.6.0",
"@mapbox/geojson-rewind": "^0.4.0",
"@mapbox/geojson-types": "^1.0.2",
"@mapbox/jsonlint-lines-primitives": "^2.0.2",
"@mapbox/mapbox-gl-supported": "^1.4.0",
"@mapbox/mbx-assembly": "^0.28.2",
"@mapbox/mr-ui": "0.5.0",
"@mapbox/point-geometry": "^0.1.0",
"@mapbox/tiny-sdf": "^1.1.0",
"@mapbox/unitbezier": "^0.0.0",
Expand All @@ -44,11 +40,15 @@
},
"devDependencies": {
"@mapbox/appropriate-images": "^2.0.0",
"@mapbox/appropriate-images-react": "^1.0.0",
"@mapbox/batfish": "1.9.8",
"@mapbox/dr-ui": "0.6.0",
"@mapbox/flow-remove-types": "^1.3.0-await.upstream.2",
"@mapbox/gazetteer": "^3.1.2",
"@mapbox/mapbox-gl-rtl-text": "^0.2.1",
"@mapbox/mapbox-gl-test-suite": "file:test/integration",
"@mapbox/mbx-assembly": "^0.28.2",
"@mapbox/mr-ui": "0.5.0",
"@octokit/rest": "^15.15.1",
"babel-eslint": "^10.0.1",
"benchmark": "^2.1.4",
Expand Down
8 changes: 7 additions & 1 deletion src/css/mapbox-gl.css
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,13 @@
.mapboxgl-ctrl-bottom-left { bottom: 0; left: 0; }
.mapboxgl-ctrl-bottom-right { right: 0; bottom: 0; }

.mapboxgl-ctrl { clear: both; pointer-events: auto; }
.mapboxgl-ctrl {
clear: both;
pointer-events: auto;

/* workaround for a Safari bug https://github.com/mapbox/mapbox-gl-js/issues/8185 */
transform: translate(0, 0);
}
.mapboxgl-ctrl-top-left .mapboxgl-ctrl { margin: 10px 0 0 10px; float: left; }
.mapboxgl-ctrl-top-right .mapboxgl-ctrl { margin: 10px 10px 0 0; float: right; }
.mapboxgl-ctrl-bottom-left .mapboxgl-ctrl { margin: 0 0 10px 10px; float: left; }
Expand Down
5 changes: 4 additions & 1 deletion src/source/canvas_source.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,10 @@ class CanvasSource extends ImageSource {
};

this.pause = function() {
this._playing = false;
if (this._playing) {
this.prepare();
this._playing = false;
}
};

this._finishLoading();
Expand Down
6 changes: 4 additions & 2 deletions src/source/source_state.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,10 @@ class SourceFeatureState {
const layerStates = {};

if (this.deletedStates[sourceLayer] === null) {
for (const ft in this.state[sourceLayer]) layerStates[ft] = {};
this.state[sourceLayer] = {};
for (const ft in this.state[sourceLayer]) {
layerStates[ft] = {};
this.state[sourceLayer][ft] = {};
}
} else {
for (const feature in this.deletedStates[sourceLayer]) {
const deleteWholeFeatureState = this.deletedStates[sourceLayer][feature] === null;
Expand Down
4 changes: 2 additions & 2 deletions src/style/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -878,12 +878,12 @@ class Style extends Evented {
return;
}

if (target.id && isNaN(featureId) || featureId < 0) {
if (target.id !== undefined && isNaN(featureId) || featureId < 0) {
this.fire(new ErrorEvent(new Error(`The feature id parameter must be non-negative.`)));
return;
}

if (key && !target.id) {
if (key && (typeof target.id !== 'string' && typeof target.id !== 'number')) {
this.fire(new ErrorEvent(new Error(`A feature id is requred to remove its specific state property.`)));
return;
}
Expand Down
Binary file added test/integration/image/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
57 changes: 57 additions & 0 deletions test/integration/render-tests/canvas/update/style.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"version": 8,
"metadata": {
"test": {
"width": 64,
"height": 64,
"addFakeCanvas": {
"id": "fake-canvas",
"image": "./image/0.png"
},
"operations": [
["wait"],
["updateFakeCanvas", "canvas", "./image/1.png", "./image/0.png"]
]
}
},
"center": [
-122.514426,
37.562984
],
"zoom": 14,
"sources": {
"canvas": {
"type": "canvas",
"animate": false,
"coordinates": [
[
-122.51596391201019,
37.56238816766053
],
[
-122.51467645168304,
37.56410183312965
],
[
-122.51309394836426,
37.563391708549425
],
[
-122.51423120498657,
37.56161849366671
]
],
"canvas": "fake-canvas"
}
},
"layers": [
{
"id": "canvas",
"type": "raster",
"source": "canvas",
"paint": {
"raster-fade-duration": 0
}
}
]
}
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,81 @@
{
"version": 8,
"metadata": {
"test": {
"width": 64,
"height": 64,
"operations": [
[
"setFeatureState",
{
"source": "geojson",
"id": "1"
},
{
"color": "red"
}
],
[
"wait"
],
[
"setZoom", 3
]
,
[
"wait"
],
[
"removeFeatureState",
{
"source": "geojson"
}
],
[
"wait"
],
[
"setZoom", 2
],
[
"wait"
]
]
}
},
"zoom": 2,
"sources": {
"geojson": {
"type": "geojson",
"data": {
"type": "Feature",
"id": "1",
"geometry": {
"type": "Point",
"coordinates": [
0,
0
]
}
}
}
},
"layers": [
{
"id": "circle",
"type": "circle",
"source": "geojson",
"paint": {
"circle-radius": 5,
"circle-color": [
"coalesce",
[
"feature-state",
"color"
],
"black"
]
}
}
]
}
16 changes: 16 additions & 0 deletions test/suite_implementation.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,16 @@ module.exports = function(style, options, _callback) { // eslint-disable-line im
map.addLayer(new customLayerImplementations[operation[1]](), operation[2]);
map._render();
applyOperations(map, operations.slice(1), callback);
} else if (operation[0] === 'updateFakeCanvas') {
const canvasSource = map.getSource(operation[1]);
canvasSource.play();
// update before pause should be rendered
updateFakeCanvas(window.document, options.addFakeCanvas.id, operation[2]);
canvasSource.pause();
// update after pause should not be rendered
updateFakeCanvas(window.document, options.addFakeCanvas.id, operation[3]);
map._render();
applyOperations(map, operations.slice(1), callback);
} else if (operation[0] === 'setStyle') {
// Disable local ideograph generation (enabled by default) for
// consistent local ideograph rendering using fixtures in all runs of the test suite.
Expand All @@ -178,3 +188,9 @@ function createFakeCanvas(document, id, imagePath) {
fakeCanvas.height = image.height;
return fakeCanvas;
}

function updateFakeCanvas(document, id, imagePath) {
const fakeCanvas = document.getElementById(id);
const image = PNG.sync.read(fs.readFileSync(path.join(__dirname, './integration', imagePath)));
fakeCanvas.data = image.data;
}
21 changes: 21 additions & 0 deletions test/unit/ui/map.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1524,6 +1524,27 @@ test('Map', (t) => {
t.end();
});
});
t.test('remove properties for zero-based feature IDs.', (t) => {
const map = createMap(t, {
style: {
"version": 8,
"sources": {
"geojson": createStyleSource()
},
"layers": []
}
});
map.on('load', () => {
map.setFeatureState({ source: 'geojson', id: 0}, {'hover': true, 'foo': true});
map.removeFeatureState({ source: 'geojson', id: 0});

const fState = map.getFeatureState({ source: 'geojson', id: 0});
t.equal(fState.hover, undefined);
t.equal(fState.foo, undefined);

t.end();
});
});
t.test('other properties persist when removing specific property', (t) => {
const map = createMap(t, {
style: {
Expand Down