RFC/POC: Extend View system to support multi-canvas rendering#10229
RFC/POC: Extend View system to support multi-canvas rendering#10229
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 72fa41c755
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (!this._isMultiCanvasMode()) { | ||
| this._destroyCanvasTargets(); | ||
| return; |
There was a problem hiding this comment.
Keep single-canvas event managers alive
In single-canvas mode, _syncCanvasTargets() immediately calls _destroyCanvasTargets(), which nulls this.eventManager/this.eventManagers. Because setProps() invokes _syncCanvasTargets() whenever this.device exists, this runs during normal initialization/update too, so getEventManager() starts returning null and later teardown paths cannot destroy the original EventManager instance (leaking listeners). This affects any app that relies on the standard single-canvas event manager lifecycle.
Useful? React with 👍 / 👎.
| if (!canvasViewports.length) { | ||
| continue; |
There was a problem hiding this comment.
Clear canvases when no views render to them
When running in multi-canvas mode, canvases with zero mapped viewports are skipped via continue, so they are never rendered or presented again. If a view is removed or reassigned to another canvas at runtime, the old frame remains visible indefinitely on the now-unused canvas, producing stale content during dynamic layout/view updates.
Useful? React with 👍 / 👎.
RFC: Multi-Canvas Presentation for deck.gl
PresentationContext@deck.gl/core@deck.gl/reactSummary
Add a multi-canvas presentation mode to deck.gl built on luma.gl 9.3
PresentationContexts.The proposal adds:
DeckProps.canvases?: (string | HTMLCanvasElement)[]View.canvasId?: stringWhen
canvasesis defined, deck.gl creates or uses an offscreen-backed default device canvas and presents rendered output into one or more DOM canvases. Views are assigned to canvases bycanvasId. Each canvas gets its ownPresentationContext, event handling root, and controller binding.This enables a single
Deckinstance to render multiple independently interactive views into separate canvases on a normal web page, while keeping React basemaps and otherViewchildren bound to the correct view and canvas.A proof-of-concept app demonstrates four independently navigable city maps on one page, each with its own basemap, controller, and filtered data.
Motivation
deck.gl today assumes a single presentation surface. This makes certain layouts awkward or impossible without creating multiple
Deckinstances:Creating multiple
Deckinstances works, but it duplicates GPU state, layer setup, animation loops, and application plumbing. luma.gl 9.3 introduces the missing primitive: one device can present to multiple canvases through multiplePresentationContexts.This RFC proposes a deck.gl integration that:
Deckand single layer graphGoals
Deckinstance.Viewmodel.Viewchildren, including basemaps, colocated with the correct canvas.canvasesprop, including add/remove/reorder.canvasesis not supplied.Non-Goals
@deck.gl/mapbox@deck.gl/google-maps@deck.gl/arcgisBackground
luma.gl 9.3 supports multiple
PresentationContexts per device. deck.gl can use this by separating:This RFC treats canvas assignment as a property of a
View, not of a layer or basemap. That keeps the model consistent:View.idbinds child content to the viewView.canvasIdbinds the view to a presentation canvasProposal
Public API
DeckProps.canvases