Canvas lose style when I create a Fabric.js canvas object

I have a Canvas object with top and left attributes defined using the previous JavaScript function, but when I create a Canvas object

  var fabricCanvas= new fabric.Canvas('mycanvas');

my HTML canvas has top and left attributes set to 0.

I tried to set the top and left attributes after creating the Canvas object using a script, but when I do this, the canvas changes position, but the fabric function (select and move functions) remains where the canvas was previously located (where the Canvas fabric positions it)!

What can I do to resolve this conflict? Is there a way to keep an equal canvas?

0
source share
2 answers

Fabric.js, div <canvas> ( , ). wiki Fabric.js. , CSS div, "canvas-container".

+2

margin: 0 auto;

= canvas-container

canvas-container .

. fiddle

0

All Articles