Layers of canvas fabric.js

JavascriptWeb DevelopmentFront End Scripts

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();
}
raja
Published on 11-Apr-2018 06:57:35
Advertisements