Geomap: Address tooltip performance issue (#71607)

This commit is contained in:
Nathan Marrs 2023-07-14 05:21:06 +02:00 committed by GitHub
parent 1a857552a1
commit 16e5d442ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 3 deletions

View File

@ -4881,7 +4881,7 @@ exports[`better eslint`] = {
"public/app/plugins/panel/geomap/utils/selection.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
],
"public/app/plugins/panel/geomap/utils/tootltip.ts:5381": [
"public/app/plugins/panel/geomap/utils/tooltip.ts:5381": [
[0, 0, 0, "Do not use any type assertions.", "0"]
],
"public/app/plugins/panel/graph/GraphContextMenuCtrl.ts:5381": [

View File

@ -29,7 +29,7 @@ import { ControlsOptions, Options, MapLayerState, MapViewConfig, TooltipMode } f
import { getActions } from './utils/actions';
import { getLayersExtent } from './utils/getLayersExtent';
import { applyLayerFilter, initLayer } from './utils/layers';
import { pointerClickListener, pointerMoveListener, setTooltipListeners } from './utils/tootltip';
import { pointerClickListener, pointerMoveListener, setTooltipListeners } from './utils/tooltip';
import { updateMap, getNewOpenLayersMap, notifyPanelEditor } from './utils/utils';
import { centerPointRegistry, MapCenterID } from './view';

View File

@ -1,3 +1,4 @@
import { debounce } from 'lodash';
import { MapBrowserEvent } from 'ol';
import { toLonLat } from 'ol/proj';
@ -12,7 +13,7 @@ import { getMapLayerState } from './layers';
export const setTooltipListeners = (panel: GeomapPanel) => {
// Tooltip listener
panel.map?.on('singleclick', panel.pointerClickListener);
panel.map?.on('pointermove', panel.pointerMoveListener);
panel.map?.on('pointermove', debounce(panel.pointerMoveListener, 200));
panel.map?.getViewport().addEventListener('mouseout', (evt: MouseEvent) => {
panel.props.eventBus.publish(new DataHoverClearEvent());
});