We are trying to emulate the Bring To Front, and Send to Back functionality using layers. For Bring to Front, we are assigning the selected objects to the “Foreground” layer. For Send to Back we are assigning the objects to the “Background” layer. However here is the issue.
When selecting a single object we want bring that object to the front of all other objects, and then send it back to it’s original zOrder. In particular we want to make sure that objects preserved their zOrder across layers and within a layer.
No, that’s an intentional design decision. Objects are placed relative to other objects in a layer (via zOrder), and entire layers are placed relative to other entire layers (via layer order).