canvas fabric.js 的层
javascriptweb developmentfront end scripts
FabricJS 具有以下 API 方法可更改对象的 z 索引:
canvas.sendBackwards(myObject) canvas.sendToBack(myObject) canvas.bringForward(myObject) canvas.bringToFront(myObject)
您还可以使用:
fabric.Canvas.prototype.orderObjects = function(compare) { this._objects.sort(compare); this.renderAll(); }