Search code examples
javascriptlaravelfabricjs

Change border color and style of Active Object in Fabric JS


I am adding one Image on Canvas. I am using FabricJS on Frontend and Laravel on the backend. I want to change the color and style of the control's broder. Here is my Object in Fabric JS

var homeImage = new fabric.Image(homeImgElement, {
  left: -10,
  top: -10,
  angle: 0,
  width:620,
  height:500,
});

Solution

  • You can check Fabric JS document for more control options. Here you go. You can even use property which is corderSize.

    var homeImage = new fabric.Image(homeImgElement, {
      left: -10,
      top: -10,
      angle: 0,
      width:620,
      height:500,
      borderColor: '#000',
      cornerColor: '#DDD',
      cornerStyle:'circle',
      cornerSize:5,
    });