Export drawElementOnCanvas() renderer method
See original GitHub issueHi, I would like to thank you for this amazing tool ! ❤️
As mentionned in https://github.com/excalidraw/excalidraw/issues/1261, I’m looking for some not-exported-yet Excalidraw renderer methods and constants for an experimental Excalidraw CLI project.
At first glance, drawElementOnCanvas()
may be the only method I need because it handles most of the element shape generation / stroke styling / drawing on canvas at once, and I would just need to pass the element and the canvas context, if I’m correct.
This method also uses some not exported useful constants :
Is it possible to export drawElementOnCanvas()
method ?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Rendering / Returning HTML5 Canvas in ReactJS
The render method creates the canvas DOM element and you can add a refs callback to set a reference to it, but you...
Read more >How to use HTML Canvas with React Hooks
Step 1: Render a canvas element · Step 2: Refer to the canvas element · Step 3: Create the canvas context · Step...
Read more >Drawing interactive shapes with Canvas elements in a React ...
You can draw shapes inside a canvas element using the Canvas APIs provided by the browser. ... export default function Sqaure() {
Read more >Add feature to export final canvas to png or base64 #43
As e.g. #36, #35, #11 show, it's a common use case to export final canvas to png or base64 using the toDataUrl() function....
Read more >2D sketches with React and the Canvas API
In the stopDraw function, we called the closePath() method and then set the state of the drawing to true. An if check was...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I believe that for the CLI, we would want to export higher level primitives: export to svg, export to png instead of the raw canvas methods.
FWIW, I used the exported
renderElement
. https://github.com/dai-shi/excalidraw-layers/blob/b3adeb24a31d87f2ab59544e8bb30bd762737606/src/viewer.worker.ts#L38