Paper.js Z-Index and Binding Object

痞子三分冷 提交于 2019-12-12 04:36:50

问题


I am studing paper.js and don´t found how resolve my problem. See my application test in: http://www.plugbox.com.br/reta.htm

The red circle covers only the Y axis and blue circle covers only the X axis and the starting point and the end point of the line follow the red and blue points.

But the line is in front of circles. How do I set the "z-index" line by placing it in a layer behind the points?

Another question is:

How do I put a third point, for example, in the middle of the line and make it draggable only on the line?

Thank´s!


回答1:


But the line is in front of circles. How do I set the "z-index" line by placing it in a layer behind the points?

Every item has methods:
insertAbove(item) //Inserts this item above the specified item.
insertBelow(item) //Inserts this item below the specified item.
sendToBack() //Sends this item to the back of all other items within the same parent.

source




回答2:


It's easy. Draw the line first and the dots afterward.Just with a real-life painting: what you draw last is atop everything you have drawn first. Plain SVG behaves the same btw.



来源:https://stackoverflow.com/questions/25691561/paper-js-z-index-and-binding-object

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