Each Primitive has a Z Position, which is determined automatically by the Canvas2D Engine and can be overridden if needed.
The actual Z Position can be retrieve by calling the getActualZOffset
method which return a number between 0 and 1.
A primitive will be drawn on the top of its parent, its previous sibling and their parents.
Which means if you have the following hierarchy of primitives:
It means:
For example if you need to move PrimB-Child1 over the top of PrimB-Child2 & PrimB-Child3 all you have to do is call the Prim2DBase.moveChild method like this:
PrimB.moveChild(PrimB-Child1, PrimB-Child3);
This call will reorder the list of children to put Child1 after Child3, ensuring a rendering on the top of both Child 2 and 3.
The zOrder
property can be set to override the default value computed using the place of the Primitive in the hierarchy. When set the getActualZOffset
method will return its value.