How to change Rotating point position to bottom in FabricJS?

Viewed 1449
1 Answers

Just use the angle to rotate the circle 180 degrees and the "Rotating point" will be at the bottom, if the object is something other than a circle add flipY to the mix to keep the object upright.

<canvas id="canvas" width="170" height="170"></canvas>

<script src="https://cdnjs.cloudflare.com/ajax/libs/fabric.js/2.3.4/fabric.min.js"></script>

<script>
  var obj = new fabric.Triangle({
    fill: 'lime',
    top: 110,
    left: 110,
    angle: 180,
    flipY: true,
    borderColor: 'red',
    cornerColor: 'cyan',
    cornerSize: 9,
    transparentCorners: false
  });
  
  var canvas = new fabric.Canvas('canvas');
  canvas.add(obj);
  canvas.setActiveObject(canvas.item(0));
</script>

Related