summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2025-03-16 19:25:36 +0100
committerTor Andersson <tor@ccxvii.net>2025-03-18 10:01:43 +0100
commit101af67b326c84f34d032bbfe4d0f17beceec4e1 (patch)
tree4495f43c0194a079e1327a699dc37f3ca7d4f34b
parent3ecd6f9f08db90faef216ea692809d34f3c1d5f7 (diff)
downloadmaria-101af67b326c84f34d032bbfe4d0f17beceec4e1.tar.gz
Make sure z-index and coords are integers.
-rw-r--r--play.js12
1 files changed, 6 insertions, 6 deletions
diff --git a/play.js b/play.js
index d1faa92..5b942f2 100644
--- a/play.js
+++ b/play.js
@@ -1119,18 +1119,18 @@ function layout_general(id, s) {
let e = ui.pieces[id]
if (e.parentElement !== ui.pieces_element)
ui.pieces_element.appendChild(e)
- e.style.left = (x - 21) + "px"
- e.style.top = (y - 29 - 15 * n) + "px"
- e.style.zIndex = y + n
+ e.style.left = Math.round(x - 21) + "px"
+ e.style.top = Math.round(y - 29 - 15 * n) + "px"
+ e.style.zIndex = Math.round(y + n)
e.classList.toggle("selected", selected)
e.classList.toggle("oos", (view.oos & (1 << id)) !== 0)
e = ui.troops[id]
if (e.parentElement !== ui.pieces_element)
ui.pieces_element.appendChild(e)
- e.style.left = (x - 7) + "px"
- e.style.top = (y + 2 - 15 * n) + "px"
- e.style.zIndex = y + n + 1
+ e.style.left = Math.round(x - 7) + "px"
+ e.style.top = Math.round(y + 2 - 15 * n) + "px"
+ e.style.zIndex = Math.round(y + n + 1)
e.className = power_class[piece_power[id]] + " piece number n" + view.troops[id]
}