8000 【 fix 】fix mapboxgl 端数据集查询的 popup 不会清除上一次查询的结果;review by xiongjj · SuperMap/iClient-JavaScript@191dea2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 191dea2

Browse files
committed
【 fix 】fix mapboxgl 端数据集查询的 popup 不会清除上一次查询的结果;review by xiongjj
1 parent 8185e35 commit 191dea2

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

examples/mapboxgl/02_datasetService.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ <h5 class='panel-title text-center' data-i18n="resources.title_DatasetInfo"></h5
6363
datasetsSelect,
6464
datasourcesSelect,
6565
datasourceName,
66+
popup;
6667
baseUrl = (window.isLocal ? window.server : "https://iserver.supermap.io") + "/iserver/services/map-world/rest/maps/World Map/zxyTileImage.png?z={z}&x={x}&y={y}",
6768
dataUrl = (window.isLocal ? window.server : "https://iserver.supermap.io") + "/iserver/services/data-world/rest/data";
6869
let attribution = "<a href='https://www.mapbox.com/about/maps/' target='_blank'>© Mapbox </a>" +
@@ -120,14 +121,17 @@ <h5 class='panel-title text-center' data-i18n="resources.title_DatasetInfo"></h5
120121

121122
function datasetsPrint(){
122123
const datasetName = datasetsSelect.value;
124+
if(popup) {
125+
popup.remove();
126+
}
123127
new mapboxgl.supermap.DatasetService(dataUrl).getDataset(datasourceName,datasetName,function (serviceResult) {
124128
let innerHTML = "(" + resources.text_datasetInfoPrint + ")" + "<br><br>";
125129
innerHTML += "dataSourceName:" + JSON.stringify(serviceResult.result.datasetInfo.dataSourceName, null, 2) + "<br>";
126130
innerHTML += "description:" + JSON.stringify(serviceResult.result.datasetInfo.description, null, 2) + "<br>";
127131
innerHTML += "isFileCache:" + JSON.stringify(serviceResult.result.datasetInfo.isFileCache, null, 2) + "<br>";
128132
innerHTML += "name:" + JSON.stringify(serviceResult.result.datasetInfo.name, null, 2) + "<br>";
129133
innerHTML += "prjCoordSys:" + "(...)" + "<br>";
130-
new mapboxgl.Popup({closeOnClick: false})
134+
popup = new mapboxgl.Popup({closeOnClick: false})
131135
.setLngLat([0,0])
132136
.setHTML(innerHTML + "</br>")
133137
.addTo(map);

0 commit comments

Comments
 (0)
0