Skip to content

Conversation

@chrisgervang
Copy link
Collaborator

@chrisgervang chrisgervang commented May 14, 2024

Closes #8877

Background

Exploring a way to exclude widgets from the deck event manager and push it above maplibre. Currently mouse event on a widget performs deck picking, which is an unwanted interaction.

propagation_short.mov

Rearranging the DOM so that the deck picker and widgets are peer elements fix the deck picking issue. Also, by nesting the deck children, such as react-map-gl in reversed controlled configuration, the deck widgets events aren't blocked by maplibre.

<!-- react-map-gl reverse controlled DOM -->
<div id="react-deckgl-wrapper">
  <div class="event-manager-root">
    <canvas class="deck-overlay" />
    <div class="react-deck-view">
      <div class="react-map-gl-root" />
      <div class="some-other-child-component" />
    </div>
  </div>
  <div class="deck-widgets-container">
    <div class="deck-view-widgets">
      <div class="fill"/>
      <div class="top-left"/>
    </div>
  </div>
</div>
react-widget-dom.mov

Flavors to test:

  • no basemap
  • React reverse controlled
  • MapboxOverlay overlaid
  • MapboxOverlay interleaved
  • Script tag
  • Python/Jupyter notebook
  • GoogleMapsOverlay

Change List

  • Core
    • If present as a child of parent, selects an .event-manager-root element for EventManager to use for picking.
    • If present as a child of parent, selects an .deck-widgets-container element for WidgetManager to add widgets to.
  • React
    • Nests deck overlay and <DeckGL/> children under .event-manager-root
    • Nests deck widgets under .deck-widgets-container

Pessimistress and others added 30 commits March 21, 2024 09:23
* Update learning-resources.md

* update slack link
* feat(carto): Support .tileSize prop in H3Tileset2D
* chore(carto): Add tests for QuadbinTileset2D getTileZoom @ tileSize
@chrisgervang chrisgervang changed the base branch from master to 9.0-release May 14, 2024 00:19
@chrisgervang chrisgervang changed the title Chr/rearrange widget dom Rearrange DOM to fix widget events in all environments May 19, 2024

const parent = this.props.parent || document.body;
const widgetParent =
parent.querySelector<HTMLDivElement>('.deck-widgets-container') || this.canvas?.parentElement;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be this.props.parent?.querySelector() like the eventRoot? Searching under document.body is suspicious...

@chrisgervang chrisgervang changed the base branch from 9.0-release to master January 7, 2025 20:02
@chrisgervang chrisgervang marked this pull request as ready for review January 7, 2025 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Widgets render below react-map-gl basemap