fabricjs will convert:
// this DOM structure
<div id="wrapper">
<canvas id="c"></canvas>
</div>
// to this:
<div id="wrapper">
<div class="canvas-container">
<canvas class="upper-canvas"></canvas>
<canvas class="lower-canvas" id="c"></canvas>
</div>
</div>
... see this explanation
Because of the way fabric js wraps a canvas element, how do you keep a canvas horizontally centered.
here is similar question. here is a fiddle test
apply
margin: 0 auto;
to class = canvas-container
canvas-container is automatically created by fabric.
see fiddle
If you are using Angular, use the project's general stylesheet (instead of the component stylesheet) to provide the css rules as @dsdsdsdsd described .canvas-container {your styles..}
. otherwise your styles may not apply.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With