When folders with ortho camera are reordered they are pushed to the back.
This can have issues with big depths.
It would be best to preserve the specified z-values as far as possible.
see e.g. code below
function orthographicFolderLayout() {
var cam = topFolderStack[0].userData.isOrthographic;
if (!cam || topFolderStack.length <= 1) return;
//camBoxSetup(cam);
// original code laid them out right at back,
// so odd z-buffer effects made them white on black, and often hidden anyway
// This respects the original z values as much as possible, but applies them in appropriate order
// If there is a clash of x values then the originals are (slightly) modified
var near = cam.near,
far = cam.far,
n = topFolderStack.length,
zs = topFolderStack.map(f => f.position.z).sort((a,b)=>a-b); // old z values small to big
zs[-1] = -9999;
zs.forEach( (z,i) => zs[i] = Math.max(zs[i], zs[i-1] + 10*Layout.PANEL_DEPTH)); // in case of equals
topFolderStack.forEach(function (f, i) {
// var z = -0.9 * far + i * 10 * Layout.PANEL_DEPTH; // original code, too near back
// var z = - (near + (n-i) * 10 * Layout.PANEL_DEPTH); // variant code stacking from front
var z = zs[i]; // use sorted (?modified) old z-values
if (z !== f.position.z) {
f.position.z = z;
f.updateMatrix();
f.fixFolderPosition();
}
});
if (topFolderStack[n - 1].position.z >= near - Layout.PANEL_DEPTH) {
console.log("GUIVR Warning: likely problem with z-order in orthographicFolderLayout");
}
//console.log(`[${topFolderStack.map(f=>f.folderName + '\t: ' + f.position.z).join('\n')}]`);
}