deck.gl
deck.gl copied to clipboard
[Bug] MVTLayer autohighlight stays highlighted when cursor leaves canvas
Description
Thanks for the great library! I am not sure if this is a bug or a feature request. Apologies.
When using MVTLayer from @deck.gl/geo-layers with autoHighlight: true, the last hovered feature remains visibly highlighted after the user’s mouse leaves the map area. The last feature under the mouse remains highlighted indefinitely until the mouse re-enters the map and hovers over a new feature.
Flavors
- [ ] Script tag
- [ ] React
- [ ] Python/Jupyter notebook
- [ ] MapboxOverlay
- [x] GoogleMapsOverlay
- [ ] CARTO
- [ ] ArcGIS
Expected Behavior
When the cursor exits the map viewport, the highlight should disappear (i.e., the hoveredFeatureId should be unset or reset).
Steps to Reproduce
- Set up a Google Maps integration using @deck.gl/google-maps with a GoogleMapsOverlay and render a MVTLayer with the above configuration.
- Hover over a feature (e.g., a polygon) in the MVTLayer. The feature is correctly highlighted.
- Move the mouse cursor out of the map container (e.g., to a sidebar, toolbar, or outside the browser window).
- Expected behavior: the highlight disappears when the mouse leaves the map.
- Actual behavior: the last hovered feature remains visibly highlighted, even though the cursor is no longer over the map.
new MVTLayer({
id: 'example-layer',
data: 'https://example.com/tiles/{z}/{x}/{y}.pbf',
binary: true,
pickable: true,
autoHighlight: true,
uniqueIdProperty: 'id',
highlightColor: [255, 0, 255, 100],
getFillColor: [100, 100, 200, 100],
getLineColor: [0, 0, 0, 255],
getLineWidth: 2
});
Environment
- Framework version: @deck.gl/[email protected]
- Browser: Firefox
- OS: MacOS
Logs
No response