Skip to content
Open
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- Fix unwanted movement when moving a pitched terrain map at high latitudes; fix freezes when moving a pitched and rotated terrain map at low zoom ([#6775](https://github.com/maplibre/maplibre-gl-js/pull/6775)) (by [@larsmaxfield](https://github.com/larsmaxfield))
- Fix issue with `static` modifier as part of mlt package ([#6796](https://github.com/maplibre/maplibre-gl-js/pull/6796)) (by [@HarelM](https://github.com/HarelM))
- _...Add new stuff here..._
- Fix `GeoJSONSource#updateData` for symbol layers ([#6801](https://github.com/maplibre/maplibre-gl-js/pull/6801) (by [@lucaswoj](https://github.com/lucaswoj)))

## 5.13.0

Expand Down
7 changes: 2 additions & 5 deletions src/source/geojson_source.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -949,13 +949,10 @@ describe('GeoJSONSource.shoudReloadTile', () => {
tile.latestFeatureIndex = new FeatureIndex(tile.tileID, source.promoteId);
tile.latestFeatureIndex.vtLayers = {
[GEOJSON_TILE_LAYER_NAME]: {
feature: (i: number) => features[i] || {}
feature: (i: number) => features[i] || {},
length: features.length
} as VectorTileLayerLike
};

for (let i = 0; i < features.length; i++) {
tile.latestFeatureIndex.insert(features[i] as VectorTileFeatureLike, [], i, 0, 0, false);
}
return tile;
}

Expand Down
13 changes: 7 additions & 6 deletions src/source/geojson_source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -509,12 +509,13 @@ export class GeoJSONSource extends Evented implements Source {

// Update the tile if it PREVIOUSLY contained an updated feature.
const layers = tile.latestFeatureIndex.loadVTLayers();
for (let i = 0; i < tile.latestFeatureIndex.featureIndexArray.length; i++) {
const featureIndex = tile.latestFeatureIndex.featureIndexArray.get(i);
const feature = layers[GEOJSON_TILE_LAYER_NAME].feature(featureIndex.featureIndex);
const id = tile.latestFeatureIndex.getId(feature, GEOJSON_TILE_LAYER_NAME);
if (prevIds.has(id)) {
return true;
if (layers[GEOJSON_TILE_LAYER_NAME]) {
for (let i = 0; i < layers[GEOJSON_TILE_LAYER_NAME].length; i++) {
const feature = layers[GEOJSON_TILE_LAYER_NAME].feature(i);
const id = tile.latestFeatureIndex.getId(feature, GEOJSON_TILE_LAYER_NAME);
if (prevIds.has(id)) {
return true;
}
}
}

Expand Down
7 changes: 6 additions & 1 deletion test/integration/render/run_render_tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import type {Page, Browser} from 'puppeteer';

import {localizeURLs} from '../lib/localize-urls';
import {launchPuppeteer} from '../lib/puppeteer_config';
import type {default as MapLibreGL, Map as MaplibreMap, CanvasSource, PointLike, StyleSpecification} from '../../../dist/maplibre-gl';
import type {default as MapLibreGL, Map as MaplibreMap, CanvasSource, GeoJSONSource, PointLike, StyleSpecification} from '../../../dist/maplibre-gl';

const __dirname = dirname(fileURLToPath(import.meta.url));
let maplibregl: typeof MapLibreGL;
Expand Down Expand Up @@ -677,6 +677,11 @@ async function getImageFromStyle(styleForTest: StyleWithTestData, page: Page): P
case 'pauseTiles':
map.style.tileManagers[operation[1]].pause();
break;
case 'updateData': {
const source = map.getSource<GeoJSONSource>(operation[1]);
await source.updateData(operation[2], true);
break;
}
default:
if (typeof map[operation[0]] === 'function') {
map[operation[0]](...operation.slice(1));
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,48 @@
{
"version": 8,
"metadata": {
"test": {
"width": 64,
"height": 64,
"operations": [
["wait"],
["updateData", "geojson", {"remove": [0]}],
["wait"]
]
}
},
"sources": {
"geojson": {
"type": "geojson",
"data": {
"type": "FeatureCollection",
"features": [{
"type": "Feature",
"id": 0,
"geometry": {
"type": "Point",
"coordinates": [0, 0]
},
"properties": {
"label": "Test"
}
}]
}
}
},
"sprite": "local://sprites/sprite",
"layers": [
{
"id": "symbol",
"type": "symbol",
"source": "geojson",
"layout": {
"text-field": ["get", "label"],
"text-size": 24
},
"paint": {
"text-color": "#ffffff"
}
}
]
}
Loading