diff --git a/ui/src/app/widget/lib/google-map.js b/ui/src/app/widget/lib/google-map.js index ba1ae1f65e..5abad621d1 100644 --- a/ui/src/app/widget/lib/google-map.js +++ b/ui/src/app/widget/lib/google-map.js @@ -338,15 +338,21 @@ export default class TbGoogleMap { locationSettings: settings, dsIndex: location.dsIndex }); - + let map = this; if (onClickListener) { google.maps.event.addListener(polygon, 'click', function (event) { - if (settings.displayTooltip) { + if (settings.displayTooltip ) { + if (settings.autocloseTooltip) { + map.tooltips.forEach((tooltip) => { + tooltip.popup.close(); + }); + } if (!polygon.anchor) { polygon.anchor = new google.maps.MVCObject(); } polygon.anchor.set("position", event.latLng); popup.open(this.map, polygon.anchor); + } onClickListener(); }); diff --git a/ui/src/app/widget/lib/tencent-map.js b/ui/src/app/widget/lib/tencent-map.js index 6ce387e46a..0cab5f9e14 100644 --- a/ui/src/app/widget/lib/tencent-map.js +++ b/ui/src/app/widget/lib/tencent-map.js @@ -287,7 +287,7 @@ export default class TbTencentMap { popup.open(); popup.setPosition(marker); }); - this.tooltips.push({ + map.tooltips.push({ markerArgs: markerArgs, popup: popup, locationSettings: settings, @@ -353,6 +353,11 @@ export default class TbTencentMap { if (onClickListener) { qq.maps.event.addListener(polygon, 'click', function (event) { + if (settings.autocloseTooltip) { + map.tooltips.forEach((tooltip) => { + tooltip.popup.close(); + }); + } if (settings.displayTooltip) { popup.setMap(this.map); popup.setPosition(event.latLng);