Skip to content

Commit

Permalink
Fix #1055 map: buggy hotspot tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
mistic100 committed Aug 23, 2023
1 parent 3e66778 commit 3b76711
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/map-plugin/src/components/MapComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 3b76711

Please sign in to comment.