summaryrefslogtreecommitdiff
path: root/ui.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2021-06-17 13:26:28 +0200
committerTor Andersson <tor@ccxvii.net>2023-02-18 12:12:42 +0100
commit3e9c5d59969de9e22691a9446a81d18911442cf7 (patch)
tree4986c8f2ddcf26278e87b138a08ab10882037938 /ui.js
parent45e37f44bb23472467698514d8dacd6ed2be5caf (diff)
downloadshores-of-tripoli-3e9c5d59969de9e22691a9446a81d18911442cf7.tar.gz
tripoli: Workaround Safari SVG bugs by avoiding SVG features.
Diffstat (limited to 'ui.js')
-rw-r--r--ui.js13
1 files changed, 5 insertions, 8 deletions
diff --git a/ui.js b/ui.js
index 32b1a33..77b4cfe 100644
--- a/ui.js
+++ b/ui.js
@@ -55,7 +55,7 @@ const TRACK_1804 = get_space_id("1804");
const TRACK_1805 = get_space_id("1805");
const TRACK_1806 = get_space_id("1806");
-let map = document.getElementById("map");
+let map = document.getElementById("svgmap");
let ui = {
spaces: {},
@@ -99,7 +99,7 @@ function build_map() {
}
for (let i = 0; i < PIECES.length; ++i) {
let piece = PIECES[i];
- let e = map.getElementById(piece);
+ let e = document.getElementById(piece);
if (e) {
e.addEventListener("mouseenter", on_focus_piece);
e.addEventListener("mouseleave", on_blur);
@@ -221,8 +221,8 @@ function update_season_marker(season) {
function set_piece_xy(p, x, y) {
let e = ui.pieces[p];
- e.setAttribute("x", x);
- e.setAttribute("y", y);
+ e.style.left = Math.round(x - e.offsetWidth/2) + "px";
+ e.style.top = Math.round(y - e.offsetHeight/2) + "px";
}
function layout_space(location, s, x0, y0, size) {
@@ -416,10 +416,7 @@ function on_click_card(evt) {
/* INITIALIZE CLIENT */
-function toggle_fit() {
- document.getElementById("map").classList.toggle("fit");
-}
-
build_map();
scroll_with_middle_mouse(".grid_center");
+init_map_zoom();
init_client([ "Tripolitania", "United States" ]);