mirror of
https://github.com/visgl/react-map-gl.git
synced 2026-01-25 16:02:50 +00:00
Making features available to onMouseEnter. This fixes issue 1473 (#1474)
This commit is contained in:
parent
7fe22d0145
commit
b7fa030090
@ -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);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user