Control z-index in Fabric.js

后端 未结 5 1122
独厮守ぢ
独厮守ぢ 2021-02-05 05:35

In fabricjs, I want to create a scene in which the object under the mouse rises to the top of the scene in z-index, then once the mouse leaves that object, it goes back to the z

5条回答
  •  不思量自难忘°
    2021-02-05 05:47

    After I added a line object, I was make the line appear under the object using:

    canvas.add(line);
    canvas.sendToBack(line);
    

    Other options are

    • canvas.sendBackwards
    • canvas.sendToBack
    • canvas.bringForward
    • canvas.bringToFront

    see: https://github.com/fabricjs/fabric.js/issues/135

提交回复
热议问题