0

This question has been asked here. But instead of a rectangular boundary, I want it to be a circle

I tried working around on one of the answers from the previous question. Here's its fiddle link. But haven't accomplished anything.

var boundingBox = new fabric.Circle({
  fill: "transparent",
  radius: 200,
  hasBorders: false,
  hasControls: false,
  lockMovementX: true,
  lockMovementY: true,
  evented: false,
  stroke: "red"
});
JetDiv
  • 1
  • Check this:http://jsfiddle.net/cRxMa/. You need to adapt to work with fabricjs – Marius Turcu Oct 10 '18 at 10:26
  • thanks for the help but this refers to the center of the object(small circle). I want the edge of the object to say within the circle – JetDiv Oct 10 '18 at 12:14
  • Check this https://jsfiddle.net/freelast/6o0o07p7/ You need to use `clipto` functionality. – Observer Oct 10 '18 at 12:52
  • Here is an exemple with circle in circle:http://jsfiddle.net/mariusturcu93/qWc3q/340/. – Marius Turcu Oct 10 '18 at 14:19
  • Thank you so much @MariusTurcu, you saved my life, but its only possible if the moving object is also a circle, if it is rectangle then a bit of the edge gets out of the boundary. – JetDiv Oct 11 '18 at 00:58
  • Hello @Observer, I could use it in other time but the specifications given to me was just to bound the object inside the circle. But thanks for the help! – JetDiv Oct 11 '18 at 01:02

0 Answers0