diff --git a/public/components/layer_control_panel/layer_control_panel.tsx b/public/components/layer_control_panel/layer_control_panel.tsx index 310ecd91..e77a8b26 100644 --- a/public/components/layer_control_panel/layer_control_panel.tsx +++ b/public/components/layer_control_panel/layer_control_panel.tsx @@ -35,11 +35,7 @@ import { LAYER_PANEL_SHOW_LAYER_ICON, LAYER_VISIBILITY, } from '../../../common'; -import { - LayerActions, - layersFunctionMap, - referenceLayerTypeLookup, -} from '../../model/layersFunctions'; +import { referenceLayerTypeLookup } from '../../model/layersFunctions'; import { useOpenSearchDashboards } from '../../../../../src/plugins/opensearch_dashboards_react/public'; import { MapServices } from '../../types'; import { @@ -48,7 +44,7 @@ import { } from '../../model/layerRenderController'; import { MapState } from '../../model/mapState'; import { ConfigSchema } from '../../../common/config'; -import {moveLayers, removeLayers, updateLayerVisibility} from "../../model/map/layer_operations"; +import { moveLayers, removeLayers, updateLayerVisibility } from '../../model/map/layer_operations'; interface MaplibreRef { current: Maplibre | null; diff --git a/public/components/map_container/map_container.tsx b/public/components/map_container/map_container.tsx index 3f215365..3d833e5d 100644 --- a/public/components/map_container/map_container.tsx +++ b/public/components/map_container/map_container.tsx @@ -13,7 +13,7 @@ import { MAP_INITIAL_STATE, DASHBOARDS_MAPS_LAYER_TYPE } from '../../../common'; import { MapLayerSpecification } from '../../model/mapLayerType'; import { IndexPattern } from '../../../../../src/plugins/data/public'; import { MapState } from '../../model/mapState'; -import { createPopup, getPopupLngLat, isTooltipEnabledLayer } from '../tooltip/create_tooltip'; +import { createPopup, getPopupLocation, isTooltipEnabledLayer } from '../tooltip/create_tooltip'; import { handleDataLayerRender } from '../../model/layerRenderController'; import { useOpenSearchDashboards } from '../../../../../src/plugins/opensearch_dashboards_react/public'; import { MapServices } from '../../types'; @@ -86,12 +86,13 @@ export const MapContainer = ({ if (features && maplibreRef.current) { clickPopup = createPopup({ features, layers: tooltipEnabledLayers }); clickPopup - ?.setLngLat(getPopupLngLat(features[0].geometry) ?? e.lngLat) + ?.setLngLat(getPopupLocation(features[0].geometry, e.lngLat)) .addTo(maplibreRef.current); } } function onMouseMoveMap(e: MapEventType['mousemove']) { + // This is required to update coordinates on map only on mouse move setCoordinates(e.lngLat.wrap()); // remove previous popup @@ -107,7 +108,7 @@ export const MapContainer = ({ showLayerSelection: false, }); hoverPopup - ?.setLngLat(getPopupLngLat(features[0].geometry) ?? e.lngLat) + ?.setLngLat(getPopupLocation(features[0].geometry, e.lngLat)) .addTo(maplibreRef.current); } } @@ -166,7 +167,13 @@ export const MapContainer = ({ return (