Skip to content

RFC/POC: Extend View system to support multi-canvas rendering - #10229

Merged
ibgreen merged 10 commits into
masterfrom
ib/multi-canvas-rfc
Aug 28, 2026
Merged

ibgreen merged 10 commits into
masterfrom
ib/multi-canvas-rfc

Conversation

@ibgreen

@ibgreen ibgreen commented Apr 16, 2026 •

Copy link
Copy Markdown
Collaborator

Goal

Add opt-in multi-canvas presentation while preserving the existing single-canvas Deck API and behavior.

Compatibility and API

  • DeckProps.canvas retains its existing scalar type, automatic canvas creation, event-manager lifecycle, and integration behavior.
  • Experimental DeckProps._canvases is intentionally a separate opt-in, as agreed during review follow-up, so existing React, Mapbox, and other single-canvas integrations cannot accidentally change behavior.
  • View.canvasId assigns a view to one presentation canvas; omitted ids select the first configured canvas.
  • Deck.getEventManager() already exists on master; this PR preserves the existing API and resolves the manager for the requested view.
  • No React implementation or React documentation changes are included.

Changes

  • Present one shared layer stack into independently sized HTML canvases using luma.gl presentation contexts.
  • Preserve custom .deck-events-root handling and route controllers, DOM events, and picking to their source canvas.
  • Position view-scoped widgets relative to their presentation canvas while keeping widget DOM under the existing shared root.
  • Clear and present canvases when their views move or are removed.
  • Document the experimental API, compatibility boundary, view assignment, picking, and widget behavior.
  • Add TSDoc for canvas targets, manager helpers, picking options, and view routing.
  • Cover multi-canvas presentation, custom event roots, canvas-aware picking, orphaned canvas clearing, and preservation/finalization of the existing single-canvas event manager.
  • Preserve strict Mapbox filtering assertions while waiting deterministically for the first redraw.

Review stack

  1. refactor(core): honor canvas contexts throughout render passes #10474, refactor(core): size and filter viewports by canvas #10475, and fix(core): position widgets relative to their canvas #10491 — merged rendering/picking, viewport-layout, and widget-positioning preparation.
  2. This PR — core multi-canvas presentation and documentation, rebased onto current master.
  3. docs(core): multi-canvas add standalone cities example #10492 — the standalone four-city example, stacked on this PR.

Validation

  • yarn — workspace dependencies updated to match current master.
  • yarn lint — passes; existing repository-wide lint warnings remain unchanged.
  • ./node_modules/.bin/tsc -p modules/core/tsconfig.json --noEmit --pretty false — passes.
  • ./node_modules/.bin/vitest run --project node --silent — 22 tests passed.
  • Normal repository pre-commit checks — lint and all 22 Node tests passed.
  • Stacked example bundles successfully with esbuild and remains limited to its four example/documentation files.
Multi-canvas presentation screenshot

@ibgreen ibgreen changed the title Ib/multi canvas rfc feat(core) Extend View system to support multi-canvas rendering Apr 16, 2026
@ibgreen ibgreen changed the title feat(core) Extend View system to support multi-canvas rendering RFC/POC: Extend View system to support multi-canvas rendering Apr 16, 2026
@ibgreen
ibgreen requested a review from heshan0131 April 16, 2026 18:05

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment thread modules/core/src/lib/deck.ts Resolved
Comment thread modules/core/src/lib/deck.ts Resolved
@ibgreen ibgreen mentioned this pull request May 2, 2026
13 of 59 tasks
@ibgreen-openai
ibgreen-openai force-pushed the ib/multi-canvas-rfc branch 2 times, most recently from 79b90e5 to 8ba7afe Compare June 12, 2026 16:53
@ibgreen-openai
ibgreen-openai changed the base branch from master to ib/multi-canvas-event-manager-prep June 12, 2026 17:02
@coveralls

coveralls commented Jun 12, 2026 •

Copy link
Copy Markdown

Coverage Status

coverage: 82.232% (+0.07%) from 82.166% — ib/multi-canvas-rfc into master

@Pessimistress Pessimistress left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

  • Did you test widgets at all? I did not see any changes to the widget manager on placement handling w/ multiple canvases.

  • I strongly recommend that you exclude react from the initial PR. The implementation looks very hacky and not conforming to reactive patterns. And this is adding on top of existing complex React flow with known bugs.

Comment thread docs/api-reference/core/deck.md Resolved
Comment thread docs/api-reference/core/deck.md Resolved
Comment thread docs/api-reference/react/deckgl.md Resolved
Comment thread docs/developer-guide/views.md Resolved
Comment thread modules/core/src/lib/canvas-manager.ts Resolved
Comment thread modules/core/src/lib/widget-manager.ts Resolved
Comment thread modules/react/src/deckgl.ts Resolved
@ibgreen-openai
ibgreen-openai force-pushed the ib/multi-canvas-event-manager-prep branch from 85cee04 to ff8fefb Compare June 15, 2026 16:43
Base automatically changed from ib/multi-canvas-event-manager-prep to master June 25, 2026 13:38
@chrisgervang chrisgervang added this to the v9.4 milestone Jun 29, 2026
@ibgreen-openai
ibgreen-openai changed the base branch from master to codex/multi-canvas-view-layout July 23, 2026 15:31
Base automatically changed from codex/multi-canvas-view-layout to codex/multi-canvas-context-plumbing July 27, 2026 18:24
@ibgreen-openai
ibgreen-openai force-pushed the codex/multi-canvas-context-plumbing branch from 05f8f9f to c15183d Compare July 27, 2026 18:29
Base automatically changed from codex/multi-canvas-context-plumbing to master July 27, 2026 18:39

Copy link
Copy Markdown
Collaborator

@Pessimistress Addressed the requested review changes and rebased the feature on the now-merged preparation work:

  • Widgets: the actual multi-canvas Deck integration test now mounts one FullscreenWidget per view, verifies both remain beneath the shared widget root, and checks their independent canvas-relative offsets and dimensions. The four-canvas cities example also mounts a view-scoped ZoomWidget on every canvas.
  • React: no modules/react or React-test files are included in this PR. The developer guide now shows the plain JavaScript Deck API and the actual HTML canvas IDs; React integration is intentionally deferred.
  • Custom event roots: each presentation canvas retains its own .deck-events-root resolution and dedicated event manager, with integration coverage.
  • Removed views: unused canvases are explicitly cleared and presented; regression coverage now verifies the exact framebuffer, transparent clear color, depth clear, and presentation.

Validation: core TypeScript checking, repository lint/pre-commit smoke tests, and all 90 focused browser tests pass.

@ibgreen-openai
ibgreen-openai changed the base branch from master to codex/multi-canvas-widget-positioning July 27, 2026 19:06
Base automatically changed from codex/multi-canvas-widget-positioning to master July 27, 2026 19:46
@ibgreen
ibgreen force-pushed the ib/multi-canvas-rfc branch from ce2ab1a to a84b4c0 Compare August 21, 2026 14:41
@greptile-apps

greptile-apps Bot commented Aug 21, 2026 •

Copy link
Copy Markdown

Greptile Summary

The PR adds an opt-in multi-canvas presentation path while preserving Deck’s existing single-canvas API and lifecycle.

  • Introduces device-bound presentation targets and per-canvas event routing.
  • Routes view layout, rendering, picking, controllers, and widgets through each view’s assigned canvas.
  • Adds public documentation and regression coverage for target reconciliation, canvas-aware picking, clearing, and event-manager behavior.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
modules/core/src/lib/canvas-manager.ts Manages per-canvas presentation contexts and event managers, including recreation when the owning device changes.
modules/core/src/lib/deck.ts Integrates multi-canvas initialization, lifecycle, picking, event routing, resizing, and public canvas-context helpers.
modules/core/src/lib/view-manager.ts Resolves view layout and viewport selection against each assigned presentation canvas.
modules/core/src/lib/deck-renderer.ts Groups and presents rendered views through their canvas-specific presentation targets.
modules/core/src/lib/widget-manager.ts Positions view-scoped widget containers relative to their assigned presentation canvases.
modules/core/src/lib/deck-picker.ts Extends picking operations with canvas-aware viewport and context selection.
test/modules/core/lib/deck.spec.ts Adds multi-canvas lifecycle, device-target replacement, event-routing, and picking regression coverage.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  D[Deck] --> VM[ViewManager]
  VM --> V1[View: canvasId A]
  VM --> V2[View: canvasId B]
  D --> CM[CanvasManager]
  CM --> P1[PresentationContext A]
  CM --> P2[PresentationContext B]
  V1 --> P1
  V2 --> P2
  P1 --> C1[Canvas A]
  P2 --> C2[Canvas B]
  C1 --> E1[EventManager A]
  C2 --> E2[EventManager B]
  E1 --> D
  E2 --> D
Loading

Reviews (7): Last reviewed commit: "Merge branch 'master' into ib/multi-canv..." | Re-trigger Greptile

Comment thread modules/core/src/lib/canvas-manager.ts Resolved
Comment thread modules/core/src/lib/canvas-manager.ts Resolved
@ibgreen

ibgreen commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator Author

@Pessimistress Rebased to latest master, ready for another review

Comment thread modules/core/src/lib/deck.ts Resolved
Comment thread modules/core/src/lib/deck.ts Resolved
Comment thread modules/core/src/lib/deck.ts Resolved
Comment thread modules/core/src/lib/deck.ts Resolved
Comment thread modules/core/src/lib/deck.ts Resolved

@Pessimistress Pessimistress left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It's quite confusing why a canvas is sometimes referenced by canvasId and sometimes by viewportId. In Deck convention everything should be indexed by viewportId.

Comment thread modules/core/src/lib/canvas-manager.ts Resolved
@ibgreen
ibgreen force-pushed the ib/multi-canvas-rfc branch from b2b0105 to c2f7318 Compare August 21, 2026 21:20
@ibgreen

ibgreen commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator Author

@Pessimistress Follow-up on the review: React remains entirely out of this PR, including its implementation, tests, docs, and example path. For multi-canvas widgets, the current implementation uses the generic WidgetManager.getCanvasBounds(viewport) path rather than widget-specific logic; it resolves the view presentation context through Deck.getCanvasContext(viewId). Added focused widget and tooltip placement regressions cover the per-canvas offsets. The current branch is rebased onto master at c2f7318 and the fresh CI run is queued.

Comment thread modules/core/src/lib/deck.ts Resolved
Comment thread modules/core/src/lib/deck.ts Resolved
Comment thread modules/core/src/lib/deck.ts Resolved
@ibgreen
ibgreen merged commit 2ebfce2 into master Aug 28, 2026
7 checks passed
@ibgreen
ibgreen deleted the ib/multi-canvas-rfc branch August 28, 2026 11:08
@ibgreen ibgreen mentioned this pull request Sep 16, 2026
14 of 70 tasks
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.

5 participants