-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: wrap renderer in a Proxy to expose Canvas2d context
Ported over from public wasm repo: #324 We recently exposed `drawImage()` support from our `CanvasRenderer`, which naturally led to seeing if we can support the rest of the Canvas2D context APIs by approaching a similar strategy (simply adding the call to our deferred `drawList`). We may be able to just return a `Proxy` from `makeRenderer()` which would intercept the calls to `CanvasRenderer` and route each API function call either to our `CanvasRenderer` if the API the user wants to call exists on it, OR the `._ctx` (the actual Canvas2D context) from `CanvasRenderer`. This should allow us to support our custom `save()`, `restore()`, `_drawImageMesh()`, etc. calls, while any non-overriden API we've wrapped in `CanvasRenderer` would go straight to the context itself. From a consumer perspective, nothing should change here. They call `const renderer = rive.makeRenderer(canvas-element)` and use `renderer.save()`, `renderer.restore()`, etc. in a render loop as expected. Diffs= 65156867f feature: wrap renderer in a Proxy to expose Canvas2d context (#5491) Co-authored-by: Zachary Plata <[email protected]>
- Loading branch information
Showing
5 changed files
with
85 additions
and
32 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
adeebb26a7ac58a1aaa18a40ed9d98af46735c97 | ||
65156867f73322b56b31c610ed7dd97a0620dc02 |
This file contains 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
This file contains 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
This file contains 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
This file contains 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