Skip to content

Commit 3667e63

Browse files
underootgithub-actions[bot]
authored andcommitted
Don't trigger render loop for not loaded images (internal-5448)
GitOrigin-RevId: e242eef016592424b1d3b7c5264a0a713498d529
1 parent 971f9a1 commit 3667e63

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/style/style.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1890,6 +1890,9 @@ class Style extends Evented<MapEvents> {
18901890
* @returns {Style}
18911891
*/
18921892
addImages(images: StyleImageMap<ImageId>): this {
1893+
if (images.size === 0) {
1894+
return this;
1895+
}
18931896
for (const [id, image] of images.entries()) {
18941897
if (this.getImage(id)) {
18951898
return this.fire(new ErrorEvent(new Error(`An image with the name "${id.name}" already exists.`)));
@@ -4334,6 +4337,13 @@ class Style extends Evented<MapEvents> {
43344337
const fqid = makeFQID(params.source, params.scope);
43354338
setDependencies(this._mergedOtherSourceCaches[fqid]);
43364339
setDependencies(this._mergedSymbolSourceCaches[fqid]);
4340+
4341+
if (params.images.some(id => id.iconsetId)) {
4342+
// If the image is an iconset, we need another render cycle
4343+
// to mark the raster-array tiles as used so we will
4344+
// request them during Style#updateImageProviders
4345+
this.fire(new Event('data', {dataType: 'style'}));
4346+
}
43374347
}
43384348

43394349
rasterizeImages(mapId: string, params: ActorMessages['rasterizeImages']['params'], callback: ActorMessages['rasterizeImages']['callback']) {

0 commit comments

Comments
 (0)