Skip to content

Commit

Permalink
[fix]changeItemVisible传参错误
Browse files Browse the repository at this point in the history
  • Loading branch information
chenxianhuii committed Sep 18, 2024
1 parent bf4bac6 commit 9c6f689
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/mapboxgl/tdt/map-switcher/TdtMapSwitcherViewModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ export default class TdtMapSwitcherViewModel extends mapboxgl.Evented {
}

togglerLabelLayer(isChecked) {
const labelLayer = this.map && this.map.getLayer(geti18n().tc(`tdtMapSwitcher.Tianditu${this.tdtLabelType}`));
labelLayer && this.webmap.changeItemVisible(geti18n().tc(`tdtMapSwitcher.Tianditu${this.tdtLabelType}`), isChecked);
const appreciableLayers = this.webmap && this.webmap.getAppreciableLayers();
const labelLayer = appreciableLayers.find(layer => layer.id === geti18n().tc(`tdtMapSwitcher.Tianditu${this.tdtLabelType}`));
labelLayer && this.webmap.changeItemVisible(labelLayer, isChecked);
}

addLayer(sources, layers, fromTdt = true) {
Expand Down
19 changes: 19 additions & 0 deletions src/mapboxgl/tdt/map-switcher/__tests__/TdtMapSwitcher.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,25 @@ describe('TdtMapSwitcher.vue', () => {
let mockOnOptions;
const webmap = {
getLayerList: () => layerCatalogs,
getAppreciableLayers: () => {
return [
{
"dataSource": {},
"id": "tdtMapSwitcher.TiandituCia",
"title": "tdtMapSwitcher.TiandituCia",
"renderSource": {
"id": "tdtMapSwitcher.TiandituCia",
"type": "raster"
},
"renderLayers": [
"tdtMapSwitcher.TiandituCia"
],
"type": "raster",
"themeSetting": {},
"visible": true
}
]
},
changeItemVisible: () => {
mockOnOptions.layersupdated();
},
Expand Down

0 comments on commit 9c6f689

Please sign in to comment.