-
Notifications
You must be signed in to change notification settings - Fork 2.2k
feat(mapbox): Add widget support to MapboxOverlay via IControl adapter #9963
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
chrisgervang
wants to merge
5
commits into
master
Choose a base branch
from
chr/mapbox-widget-support
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Enable deck widgets to coexist with native Mapbox/MapLibre controls without DOM overlap by rendering widgets with viewId: 'mapbox' into the map's control container system. - Add DeckWidgetControl class that wraps deck widgets as IControls - Process widgets with viewId: 'mapbox' in MapboxOverlay - Set widget._container to Mapbox-positioned element via IControl - Widgets stack correctly with native controls in same container Closes #9962 Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Add TestWidget class for testing widget integration - Test regular widgets render in deck container - Test widgets with viewId: 'mapbox' are wrapped as IControl - Test mixed widgets (regular + mapbox) - Test setProps updates widget controls - Test interleaved mode widget support - Update mock map to support control positions and hasControl Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Overlaid mode tests create their own Deck instances which can cause GL context corruption when sharing contexts across tests. Using an isolated WebGLDevice for these tests prevents hangs in the test suite. Co-Authored-By: Claude (global.anthropic.claude-opus-4-5-20251101-v1:0) <noreply@anthropic.com>
…d rootElement When setProps was called with widgets, _processWidgets would destroy and recreate all DeckWidgetControls. This removed the container from the DOM, orphaning the widget's rootElement since WidgetManager wouldn't re-attach it (same widget id means no change detected). Now matches widgets by id (like WidgetManager) and only recreates controls when the widget is new or placement changes. For existing widgets with same id and placement, the container is preserved and copied to the new widget instance to support React patterns where widgets are recreated on render. Co-Authored-By: Claude (global.anthropic.claude-opus-4-5-20251101-v1:0) <noreply@anthropic.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #9962
Background
Enable deck widgets to coexist with native Mapbox/MapLibre controls without DOM overlap by rendering widgets with
viewId: 'mapbox'into the map's control container system via the new_containerprop.Change List
DeckWidgetControlclass that wraps deck widgets as Mapbox IControlsviewId: 'mapbox'in MapboxOverlay, automatically wrapping them as IControlswidget.props._containerto Mapbox-positioned element so WidgetManager appends thereNote
Medium Risk
Touches
MapboxOverlaylifecycle and DOM/control management, which could affect widget mounting/unmounting andsetPropsbehavior across interleaved/overlaid modes.Overview
Adds widget placement support to
MapboxOverlayby introducingDeckWidgetControl, anIControladapter that mounts deck.gl widgets into Mapbox/MapLibre’s native control containers (viawidget.props._container) whenwidget.viewId === 'mapbox'.MapboxOverlaynow creates/updates/removes these widget controls ononAdd,setProps, andonRemove, reusing existing controls by widgetidwhen placement is unchanged to avoid DOM orphaning; tests and mocks are updated to cover overlaid/interleaved widget behavior and control lifecycle (plus a minor test GL setup cleanup).Written by Cursor Bugbot for commit 67aeed4. This will update automatically on new commits. Configure here.