question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Export drawElementOnCanvas() renderer method

See original GitHub issue

Hi, 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 :

https://github.com/excalidraw/excalidraw/blob/046c0818c5b39b78c70646b5f9a1c28f31787694/src/renderer/renderElement.ts#L29-L30

Is it possible to export drawElementOnCanvas() method ?

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:1
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
vjeuxcommented, Jun 22, 2020

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found