Skip to content

Commit

Permalink
Making features available to onMouseEnter. This fixes issue 1473 (#1474)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeslemmer authored and Pessimistress committed Jun 4, 2021
1 parent 7fe22d0 commit b7fa030
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/components/interactive-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,16 +215,20 @@ function onPointerMove(event) {
if (interactiveLayerIds || onHover) {
features = getFeatures.call(this, event.point);
}
if (onHover) {
// backward compatibility: v3 `onHover` interface
event.features = features;
onHover(event);
}

const isHovering = Boolean(interactiveLayerIds && features && features.length > 0);
const isEntering = isHovering && !this.state.isHovering;
const isExiting = !isHovering && this.state.isHovering;

if (onHover || isEntering) {
event.features = features;

// backward compatibility: v3 `onHover` interface
if (onHover) {
onHover(event);
}
}

if (isEntering) {
onEvent.call(this, 'onMouseEnter', event);
}
Expand Down

0 comments on commit b7fa030

Please sign in to comment.