Layers of canvas fabric.js



FabricJS has the following API methods that change the z-index of objects:

canvas.sendBackwards(myObject)
canvas.sendToBack(myObject)
canvas.bringForward(myObject)
canvas.bringToFront(myObject)

You can also use:

fabric.Canvas.prototype.orderObjects = function(compare) {
   this._objects.sort(compare);
   this.renderAll();
}
karthikeya Boyini
karthikeya Boyini

I love programming (: That's all I know


Advertisements