From 3b767116d7508a15d79d9f4950145dafe8d00bec Mon Sep 17 00:00:00 2001 From: Damien SOREL Date: Wed, 23 Aug 2023 13:02:43 +0200 Subject: [PATCH] Fix #1055 map: buggy hotspot tooltip --- packages/map-plugin/src/components/MapComponent.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/map-plugin/src/components/MapComponent.ts b/packages/map-plugin/src/components/MapComponent.ts index f57775c5e..6646e3611 100644 --- a/packages/map-plugin/src/components/MapComponent.ts +++ b/packages/map-plugin/src/components/MapComponent.ts @@ -240,6 +240,7 @@ export class MapComponent extends AbstractComponent { case 'transitionend': if (!this.state.maximized) { this.overlay.style.display = ''; + this.recenter(); } this.state.forceRender = false; this.update(); @@ -566,6 +567,17 @@ export class MapComponent extends AbstractComponent { * Finds the hotspot under the mouse */ private __findHotspot(clientX: number, clientY: number): string { + // ensure the cursor is above the canvas (circle shape) + if (!this.state.maximized) { + const radius = this.container.offsetWidth / 2; + const top = this.container.offsetTop; + const left = this.container.offsetLeft; + + if (utils.distance({ x: clientX, y: clientY }, { x: left + radius, y: top + radius }) > radius) { + return null; + } + } + const k = this.config.spotSize / 2; let hotspotId: string = null;