Skip to content

Commit

Permalink
Avoid trigger tooltip from label (#350)
Browse files Browse the repository at this point in the history
Signed-off-by: Junqiu Lei <junqiu@amazon.com>
  • Loading branch information
junqiu-lei committed Mar 17, 2023
1 parent 8744efb commit c5ee47a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
8 changes: 8 additions & 0 deletions public/components/tooltip/display_features.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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,
Expand Down

0 comments on commit c5ee47a

Please sign in to comment.