FabricJS: Always Center Object on Canvas

后端 未结 2 1609
滥情空心
滥情空心 2021-02-05 22:27

is it possible to ALWAYS center an object on a fabricjs canvas?

Background: I am building a webtool that makes it easy to create complex animations using fabricjs. I wan

2条回答
  •  庸人自扰
    2021-02-05 22:53

    Or you can center the object like so

        // add the image object 
        Canvas.add(oImg)
        // set the object to be centered to the Canvas
        Canvas.centerObject(oImg);
    
        Canvas.setActiveObject(oImg);
        Canvas.renderAll();
    

提交回复
热议问题