I want the Raphael-react components to be drawn in the order I need (to create different layers or something like z-index). How can I control the position of components "Path" on the "Paper"?
This is a simplified view:
<Paper>
<Set>
<Path .../>
<Path .../>
<Path .../>
</Set>
</Paper>
It seems that Raphael doesn't support z-index, but you can achieve the goal if you keep all data in an array inside
local state(or Redux):Then if you'll want change z-Index of element just move it in array:
I prepare demo for you with the Olympic Rings where I just shuffle them.
You can see it here
Of course,
randomis useless. You need to maintain azOrderon each element to work properly.And if you want work with all figures you can add
polymorphism. And save the element's type (circle, line, etc.)Code would be like this: