fabricjs 1.6.3: why active object is always shown on top

ぃ、小莉子 提交于 2019-12-01 07:22:45

问题


good demo of my problem: http://fabricjs.com/hovering If you select any item, it is displayed on top. In earlier versions (1.5.0 - 1.6.2) this problem does not exist. Sorry for bad English.


回答1:


If you dont want thie behaviour, you can set the preserveObjectStacking to true. Check the docs here: http://fabricjs.com/docs/fabric.Canvas.html

However, there is this one issue with background objects, so beware https://github.com/kangax/fabric.js/issues/3095

Hopefully, they'll push a fix soon otherwise your last resort would be going back to 1.6.2.




回答2:


I believe that is meant as a convenience for the user. Although the object moves to the front while selected, as soon as it is deselected, it falls back to its original z-order.

You can test this out at the hovering demo you linked. Superimpose two objects and determine which is front of the other then select and deselect the object in the back. When you hover over them, the order should still be observed to be the same.



来源:https://stackoverflow.com/questions/38247337/fabricjs-1-6-3-why-active-object-is-always-shown-on-top

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!