diff --git a/src/mapbox/mapbox.ts b/src/mapbox/mapbox.ts index 8f4b3aed1..b3643d8f8 100644 --- a/src/mapbox/mapbox.ts +++ b/src/mapbox/mapbox.ts @@ -625,18 +625,25 @@ export default class Mapbox< } _onPointerEvent = (e: MapMouseEvent | MapMouseEvent) => { - if (e.type === 'mousemove' || e.type === 'mouseout') { - this._updateHover(e); - } + const map = this._map; + const tr = map.transform; + try { + map.transform = this._renderTransform; + if (e.type === 'mousemove' || e.type === 'mouseout') { + this._updateHover(e); + } - // @ts-ignore - const cb = this.props[pointerEvents[e.type]]; - if (cb) { - if (this.props.interactiveLayerIds && e.type !== 'mouseover' && e.type !== 'mouseout') { - e.features = this._hoveredFeatures || this._queryRenderedFeatures(e.point); + // @ts-ignore + const cb = this.props[pointerEvents[e.type]]; + if (cb) { + if (this.props.interactiveLayerIds && e.type !== 'mouseover' && e.type !== 'mouseout') { + e.features = this._hoveredFeatures || this._queryRenderedFeatures(e.point); + } + cb(e); + delete e.features; } - cb(e); - delete e.features; + } finally { + map.transform = tr; } };