Skip to content

Core seam for server-side and export embedders - #38

Open
calumk wants to merge 1 commit into
quickdrawjs:mainfrom
calumk:core-render-seam
Open

calumk wants to merge 1 commit into
quickdrawjs:mainfrom
calumk:core-render-seam

Conversation

@calumk

@calumk calumk commented Nov 1, 2026

Copy link
Copy Markdown

Fixes #37.

Small, dependency-free, behavior-preserving seam so out-of-tree renderers (see #36) can reuse the engine instead of forking it:

  • setShapePlatform({ Path2D, measureCtx, tileCanvas }) — explicit backend injection; the browser never calls it, globals are never patched.
  • drawShape per-render opts: Path2D class, pre-decoded images map (bypasses the browser loader — no placeholders), patternCache map. No shared per-render state.
  • Shared sortShapesForRender() now backing Editor.shapesSorted() (identical behavior), plus textLayout / noteLayout / boundsUnion exports and full type declarations.
  • New platform.test.js proves the injection paths with recording fakes.

Note: overlaps #31's comparator — if that merges first, the helper takes the layered version on rebase (one-line change, test updated alongside).

Explicit backend injection (setShapePlatform) plus per-render drawShape
opts (Path2D class, pre-decoded images map, pattern cache) so non-browser
renderers reuse the engine without touching globals; shared paint-order
helper used by the editor; new exports and types. No behavior change, no
new dependencies.
@vercel

vercel Bot commented Nov 1, 2026

Copy link
Copy Markdown

@calumk is attempting to deploy a commit to the naman's projects Team on Vercel.

A member of the Team first needs to authorize it.

This branch has not been deployed

No deployments
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.

Core seam for server-side and export embedders

1 participant