z-index adapted from the 2d editor