deck.gl icon indicating copy to clipboard operation
deck.gl copied to clipboard

[Bug] MVTLayer autohighlight stays highlighted when cursor leaves canvas

Open brenwell opened this issue 5 months ago • 0 comments

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

Image
  1. Set up a Google Maps integration using @deck.gl/google-maps with a GoogleMapsOverlay and render a MVTLayer with the above configuration.
  2. Hover over a feature (e.g., a polygon) in the MVTLayer. The feature is correctly highlighted.
  3. Move the mouse cursor out of the map container (e.g., to a sidebar, toolbar, or outside the browser window).
  4. Expected behavior: the highlight disappears when the mouse leaves the map.
  5. 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

Logs

No response

brenwell avatar Jun 12 '25 14:06 brenwell