chiark / gitweb /
script: When lowering, avoid raising
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 5 Jul 2021 22:17:17 +0000 (23:17 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 6 Jul 2021 00:24:04 +0000 (01:24 +0100)
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>
templates/script.ts

index e069f04dafc6ee1dd511a6c44de6b0d7f6f6a7a9..933781b51fffb1258b66f0ba0fc481467ca6ceb5 100644 (file)
@@ -741,6 +741,11 @@ function lower_pieces(targets_todo: LowerTodoList):
   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());