summaryrefslogtreecommitdiff
path: root/play.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-11-08 00:09:31 +0100
committerTor Andersson <tor@ccxvii.net>2023-11-09 00:56:25 +0100
commit8594a088047e7b387b775714f25a5f46b3f5ae46 (patch)
treec566155c05fa43c5ac2200508d1eeb952807feb9 /play.js
parentf306d32e24d003ac1f401a61e880a1be41d110d1 (diff)
downloadalgeria-8594a088047e7b387b775714f25a5f46b3f5ae46.tar.gz
Show half-value PSL.
Diffstat (limited to 'play.js')
-rw-r--r--play.js30
1 files changed, 24 insertions, 6 deletions
diff --git a/play.js b/play.js
index eaa85aa..16cce83 100644
--- a/play.js
+++ b/play.js
@@ -416,11 +416,24 @@ function on_blur(_evt) {
let LAYOUT_TRACK = []
let track_count = Array(100).fill(0)
-
-function layout_track(track, e) {
+function layout_track(track_frac, e) {
+ let track = track_frac | 0
let n = track_count[track]
let x = LAYOUT_TRACK[track][0] - 20
let y = LAYOUT_TRACK[track][1] - 20
+ let z = n
+
+ if (track_frac > track) {
+ let x2 = LAYOUT_TRACK[track+1][0] - 20
+ let y2 = LAYOUT_TRACK[track+1][1] - 20
+ x = (x + x2) >> 1
+ y = (y + y2) >> 1
+ if (track_count[track] > 0 || track_count[track+1] > 0)
+ n = 0.5
+ else
+ n = 0
+ z = 10
+ }
let dx = 0
let dy = 41
@@ -445,9 +458,10 @@ function layout_track(track, e) {
e.style.left = x + (dx * n) + "px"
e.style.top = y + (dy * n) + "px"
- e.style.zIndex = n
+ e.style.zIndex = z
- track_count[track] = n + 1
+ if (track_frac === track)
+ track_count[track] = n + 1
}
function layout_stack(loc_id, box_id) {
@@ -753,16 +767,20 @@ function update_map() {
ui.psl[GOV].textContent = view.gov_psl
track_count.fill(0)
+
layout_track(view.turn % 100, ui.markers.turn)
layout_track(view.fln_ap, ui.markers.fln_ap)
layout_track(view.fln_psl, ui.markers.fln_psl)
layout_track(view.gov_psl, ui.markers.gov_psl)
+
+ layout_track(view.air_max, ui.markers.air_max)
if (view.air_max)
layout_track(view.air_avail, ui.markers.air_avail)
- layout_track(view.air_max, ui.markers.air_max)
+
+ layout_track(view.helo_max, ui.markers.helo_max)
if (view.helo_max)
layout_track(view.helo_avail, ui.markers.helo_avail)
- layout_track(view.helo_max, ui.markers.helo_max)
+
layout_track(view.naval, ui.markers.naval)
// Hide avail markers when no Air / Helo at all