It can happen that the z of the piece which sets the z_top for the end
of the plan (with z_bot == null) will cause the first lowered piece to
actually be raised.
This is particularly troublesome if the piece is an occulting one,
which the server will not allowe to be raised.
Handle this case specially: if necessary, set the z_top to top piece
of that plan entry.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
for (const pe of plan) {
if (pe.z_top != null) z_top = pe.z_top;
let z_bot = pe.z_bot;
+ if (pe.content.length != 0 && z_bot == null) {
+ let first_z = pe.content[0].p.z;
+ if (z_top >= first_z)
+ z_top = first_z;
+ }
let zrange = wasm_bindgen.range(z_bot, z_top, pe.content.length);
console.log('LOQER PLAN PE',
pe, z_bot, z_top, pe.content.length, zrange.debug());