-
-
Notifications
You must be signed in to change notification settings - Fork 36k
Description
Description
Currently, when rendering CSS2DObject
instances through CSS2DRenderer
, they always get assigned ascending z-index
values in css. This poses a problem if you want some children of one of these objects to occlude other children of another object, since the containers have different z-indexes and are therefor in different stacking contexts. I would like a way to disable this functionality, since it's not even currently possible to feasibly overwrite at runtime, since the zOrder
method is defined inside the constructor, not on the actual class.
Solution
Adding a way of disabling automatic z ordering would be my solution of choice, Be it a constructor argument or a method on the renderer itself or any other interface, I would just like the option to exist.
Example:
class CSS2DRenderer{
sortZ = true;
render(...){
...
if ( this.sortZ ) this.zOrder( scene );
}
}
Alternatives
The only ways I currently see it possible to opt out of auto z-index assignment is to
- Overwrite the
render
method after creating the renderer instance, this is very much an anti-pattern - Manually remove or change the z-index attribute of the elements after calling the
render
method, which adds unnecessary complexity to the render loop in my opinion
Additional context
No response