diff --git a/CHANGELOG.md b/CHANGELOG.md index 094b8389..7334b12b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), * Update max supported layer count ([#332](https://github.com/opensearch-project/dashboards-maps/pull/332)) * BWC for document layer label textType ([#340](https://github.com/opensearch-project/dashboards-maps/pull/340)) * Add mapbox-gl draw mode ([#347](https://github.com/opensearch-project/dashboards-maps/pull/347)) +* Avoid trigger tooltip from label ([#350](https://github.com/opensearch-project/dashboards-maps/pull/350)) ### Bug Fixes * Fix property value undefined check ([#276](https://github.com/opensearch-project/dashboards-maps/pull/276)) diff --git a/public/components/tooltip/display_features.tsx b/public/components/tooltip/display_features.tsx index 5e389be9..cf9d597b 100644 --- a/public/components/tooltip/display_features.tsx +++ b/public/components/tooltip/display_features.tsx @@ -32,6 +32,10 @@ export const DisplayFeatures = memo(({ map, layers }: Props) => { const features = map.queryRenderedFeatures(e.point); if (features && map) { + // don't show tooltip from labels + if (features.length === 1 && features[0].layer?.type === 'symbol') { + return; + } clickPopup = createPopup({ features, layers: tooltipEnabledLayers }); clickPopup?.setLngLat(getPopupLocation(features[0].geometry, e.lngLat)).addTo(map); } @@ -44,6 +48,10 @@ export const DisplayFeatures = memo(({ map, layers }: Props) => { const tooltipEnabledLayersOnHover = layers.filter(isTooltipEnabledOnHover); const features = map.queryRenderedFeatures(e.point); if (features && map) { + // don't show tooltip from labels + if (features.length === 1 && features[0].layer?.type === 'symbol') { + return; + } hoverPopup = createPopup({ features, layers: tooltipEnabledLayersOnHover,