From a2bcf4451cbf7b763d7fb50d4b8a65ad5321af7e Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Mon, 18 Mar 2024 01:49:30 +0100 Subject: markers. --- play.js | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) (limited to 'play.js') diff --git a/play.js b/play.js index 76c4c02..76a8079 100644 --- a/play.js +++ b/play.js @@ -22,23 +22,25 @@ function make_road(type, x, y, dx, dy) { } function on_init() { - for (let a = 0; a <= last_city; ++a) { - for (let b of cities.major_roads[a]) { - if (a < b) { - let dx = cities.x[a] - cities.x[b] - let dy = cities.y[a] - cities.y[b] - let x = (cities.x[a] + cities.x[b]) / 2 - let y = (cities.y[a] + cities.y[b]) / 2 - make_road("major_road", x - 10, y - 3, dx, dy) + if (false) { + for (let a = 0; a <= last_city; ++a) { + for (let b of cities.major_roads[a]) { + if (a < b) { + let dx = cities.x[a] - cities.x[b] + let dy = cities.y[a] - cities.y[b] + let x = (cities.x[a] + cities.x[b]) / 2 + let y = (cities.y[a] + cities.y[b]) / 2 + make_road("major_road", x - 10, y - 3, dx, dy) + } } - } - for (let b of cities.roads[a]) { - if (a < b) { - let dx = cities.x[a] - cities.x[b] - let dy = cities.y[a] - cities.y[b] - let x = (cities.x[a] + cities.x[b]) / 2 - let y = (cities.y[a] + cities.y[b]) / 2 - make_road("road", x - 10, y - 1, dx, dy) + for (let b of cities.roads[a]) { + if (a < b) { + let dx = cities.x[a] - cities.x[b] + let dy = cities.y[a] - cities.y[b] + let x = (cities.x[a] + cities.x[b]) / 2 + let y = (cities.y[a] + cities.y[b]) / 2 + make_road("road", x - 10, y - 1, dx, dy) + } } } } @@ -64,6 +66,7 @@ function on_init() { y -= 12 } + e.classList.add("hide") e.style.left = x + "px" e.style.top = y + "px" e.title = cities.name[a] -- cgit v1.2.3