summaryrefslogtreecommitdiff
path: root/play.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-05-24 21:26:29 +0200
committerTor Andersson <tor@ccxvii.net>2023-05-25 13:40:02 +0200
commit2df33971edc881dbe8f613921448c1f68773b17e (patch)
tree9b33b81e288a3d696c91b326b36538d00f896436 /play.js
parent0257e4fee8a824dec3730bbe5b99b242c96325a8 (diff)
downloadred-flag-over-paris-2df33971edc881dbe8f613921448c1f68773b17e.tar.gz
More UI tweaks.
Diffstat (limited to 'play.js')
-rw-r--r--play.js31
1 files changed, 17 insertions, 14 deletions
diff --git a/play.js b/play.js
index 9a86ca0..47d1418 100644
--- a/play.js
+++ b/play.js
@@ -313,8 +313,6 @@ function build_user_interface() {
let name = space_names[s]
let [x, y, w, h] = boxes[name]
let cn = "space"
- if (s < 12)
- cn += " " + DIMENSION_CLASS[s]
if (s === 0 || s === 3 || s === 6 || s === 9) {
cn += " pivotal"
x -= 22
@@ -327,18 +325,21 @@ function build_user_interface() {
w -= 10
h -= 10
}
- elt = ui.spaces[s] = create("div", {
- className: cn,
- my_space: s,
- my_name: name,
- onmousedown: on_click_space,
- onmouseenter: on_focus_space,
- onmouseleave: on_blur,
- style: `top: ${y-1}px;left:${x-1}px;width:${w+2}px;height:${h+2}px`
- })
+ if (s < 12) {
+ cn += " " + DIMENSION_CLASS[s]
+ elt = ui.spaces[s] = create("div", {
+ className: cn,
+ my_space: s,
+ my_name: name,
+ onmousedown: on_click_space,
+ onmouseenter: on_focus_space,
+ onmouseleave: on_blur,
+ style: `top: ${y-1}px;left:${x-1}px;width:${w+2}px;height:${h+2}px`
+ })
+ document.getElementById("spaces").appendChild(elt)
+ }
space_layout_cube[s] = { x: x + Math.round(w/2), y: y + Math.round(h*1/2) }
space_layout_disc[s] = { x: x + w, y: y + h }
- document.getElementById("spaces").appendChild(elt)
}
}
@@ -568,8 +569,10 @@ function on_update() {
for (let i = 0; i < space_count; ++i) {
layout_cubes(layout[i], space_layout_cube[i].x, space_layout_cube[i].y)
- ui.spaces[i].classList.toggle("action", is_space_action(i))
- ui.spaces[i].classList.toggle("selected", i === view.where)
+ if (i < 12) {
+ ui.spaces[i].classList.toggle("action", is_space_action(i))
+ ui.spaces[i].classList.toggle("selected", i === view.where)
+ }
}
for (let i = 0; i < 4; ++i) {
layout_disc(view.pieces[36+i], ui.discs[i])