diff options
author | Tor Andersson <tor@ccxvii.net> | 2022-07-27 19:29:18 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2022-11-17 13:11:26 +0100 |
commit | dd5314b7a0c4fced7909f90a3b5d6a7aa30db215 (patch) | |
tree | 1264d875cffd1a716630b8fdc1251e8f85b59294 | |
parent | 736097bab6ce3d9b59f791b8dad0d7cd98c9d584 (diff) | |
download | rommel-in-the-desert-dd5314b7a0c4fced7909f90a3b5d6a7aa30db215.tar.gz |
Keep expanded stack on screen.
-rw-r--r-- | play.js | 30 |
1 files changed, 20 insertions, 10 deletions
@@ -485,29 +485,39 @@ function update_map() { } } + for (let hex = 0; hex < stack.length; ++hex) { + let start_x = ui.hex_x[hex] + let start_y = ui.hex_y[hex] + + if (stack[hex] === ui.focus) { + let height = stack[hex].length * 56 + if (start_y + height + 25 > 960) + start_y = 960 - height + 25 + } + for (let i = 0; i < stack[hex].length; ++i) { let u = stack[hex][i] let e = ui.units[u] let x, y, z if (stack[hex] === ui.focus) { - x = ui.hex_x[hex] - 25 - y = ui.hex_y[hex] - 25 + i * 56 + x = start_x - 25 + y = start_y - 25 + i * 56 z = 100 } else { if (stack[hex].length <= 1) { - x = ui.hex_x[hex] - 25 + i * 11 - y = ui.hex_y[hex] - 25 + i * 14 + x = start_x - 25 + i * 11 + y = start_y - 25 + i * 14 } else if (stack[hex].length <= 4) { - x = ui.hex_x[hex] - 30 + i * 11 - y = ui.hex_y[hex] - 30 + i * 14 + x = start_x - 30 + i * 11 + y = start_y - 30 + i * 14 } else if (stack[hex].length <= 8) { - x = ui.hex_x[hex] - 30 + i * 4 - y = ui.hex_y[hex] - 30 + i * 4 + x = start_x - 30 + i * 4 + y = start_y - 30 + i * 4 } else { - x = ui.hex_x[hex] - 35 + i * 3 - y = ui.hex_y[hex] - 35 + i * 3 + x = start_x - 35 + i * 3 + y = start_y - 35 + i * 3 } z = 1 + i } |