Skip to content

Commit 78bb605

Browse files
committed
【feature】图层列表显隐初始值优化
1 parent 5e524dd commit 78bb605

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/mapboxgl/mapping/webmap/v3/WebMap.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ export class WebMap extends mapboxgl.Evented {
507507
}
508508
layersOnMap.push({
509509
id: overlayLayer.id,
510-
visibility,
510+
layout: { visibility },
511511
source,
512512
type: overlayLayer.type
513513
});
@@ -558,11 +558,12 @@ export class WebMap extends mapboxgl.Evented {
558558
}
559559
}
560560
const sourceOnMap = this.map.getSource(layer.source);
561+
const layout = layer.layout || {};
561562
const overlayLayers = this._formatLayer({
562563
id: layer.id,
563564
type: layer.type,
564565
title,
565-
visible: layer.visibility ? layer.visibility === 'visible' : true,
566+
visible: layout.visibility ? layout.visibility === 'visible' : true,
566567
renderSource: sourceOnMap && {
567568
id: layer.source,
568569
type: sourceOnMap && sourceOnMap.type,

0 commit comments

Comments
 (0)