Skip to content

Commit

Permalink
avoid opening up multiple tooltips in same location
Browse files Browse the repository at this point in the history
  • Loading branch information
nreese committed Feb 10, 2020
1 parent 09012ec commit a1da30b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions x-pack/legacy/plugins/maps/public/actions/map_actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

import _ from 'lodash';
import turf from 'turf';
import turfBooleanContains from '@turf/boolean-contains';
import uuid from 'uuid/v4';
Expand Down Expand Up @@ -428,8 +429,12 @@ export function closeOnClickTooltip(tooltipId) {

export function openOnClickTooltip(tooltipState) {
return (dispatch, getState) => {
const openTooltips = getOpenTooltips(getState()).filter(({ isLocked }) => {
return isLocked;
const openTooltips = getOpenTooltips(getState()).filter(({ features, location, isLocked }) => {
return (
isLocked &&
!_.isEqual(location, tooltipState.location) &&
!_.isEqual(features, tooltipState.features)
);
});

openTooltips.push({
Expand Down

0 comments on commit a1da30b

Please sign in to comment.