Control z-index in Fabric.js

后端 未结 5 1119
独厮守ぢ
独厮守ぢ 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 06:13

    Since fabric.js version 1.1.4 a new method for zIndex manipulation is available:

    canvas.moveTo(object, index);
    object.moveTo(index);
    

    I think this is helpful for your use case. I've updated your jsfiddle - i hope this is what you want:
    jsfiddle

提交回复
热议问题