From 3e9c5d59969de9e22691a9446a81d18911442cf7 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Thu, 17 Jun 2021 13:26:28 +0200 Subject: tripoli: Workaround Safari SVG bugs by avoiding SVG features. --- ui.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'ui.js') 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" ]); -- cgit v1.2.3