0

https://github.com/salgum1114/react-design-editor/blob/8db73ef3d9846444e25657a5414b417633b1ef0e/src/components/Canvas.js

I have gone through the code on the above link. But I can't seem to understand Line 495 where its written this.canvas.wrapperEl as it is not defined anywhere.

PRS
  • 11
  • 3

1 Answers1

1

This is a reference to the wrapper div element that fabric.js wraps around the actual canvas it draws on. This property is intended for internal use, that's why there is no mention of it in the docs.

If you inspect the HTML on a page that uses a fabric.js canvas in it, you'll see something like this:

<div class="canvas-container" style="...">
  <canvas id="c" width="1000" height="800" class="lower-canvas" style="..."></canvas>
  <canvas class="upper-canvas" width="500" height="400" style="..."></canvas>
</div>

The canvas-container div is your wrapperEl.

shkaper
  • 4,689
  • 1
  • 22
  • 35