From 111a0f6e452d667ddc6b4220b9693a6e6e5f9d10 Mon Sep 17 00:00:00 2001 From: snoopy Date: Tue, 30 Apr 2024 01:56:38 +0200 Subject: [PATCH] Changes map and update coordinate grid to c4 map --- static/80x80.svg | 442 ++++++++++++++++++++++++++++++++++++++++++++++- static/form.js | 8 +- static/shared.js | 18 +- static/style.css | 6 +- 4 files changed, 457 insertions(+), 17 deletions(-) diff --git a/static/80x80.svg b/static/80x80.svg index d0124e9..831049d 100644 --- a/static/80x80.svg +++ b/static/80x80.svg @@ -1 +1,441 @@ -/home/me/stuff/cccac/clubraum/plan_0.5.sh3dCreator: FreeHEP Graphics2D Driver Producer: com.eteks.sweethome3d.swing.PlanComponent$SVGSupport$1 Revision: 12753 Source: me Date: Monday, June 6, 2022 11:58:58 PM CEST \ No newline at end of file + + + + diff --git a/static/form.js b/static/form.js index b69f358..16ebf7e 100644 --- a/static/form.js +++ b/static/form.js @@ -136,14 +136,14 @@ function del() { let clicks = {x: [], y: []}; function mapClick(e) { - let x = Math.floor(31 / e.target.width * e.layerX); - let y = Math.floor(10 / e.target.height * e.layerY); + let x = Math.floor(37 / e.target.width * e.layerX); + let y = Math.floor(18 / e.target.height * e.layerY); let humanPos = (x, y) => { - return `${String.fromCharCode(65 + 8 - y)}${x}`; + return `${String.fromCharCode(65 + 16 - y)}${x}`; }; - if (x > 0 && x < 31 && y > 0 && y < 9) { + if (x > 0 && x < 37 && y > 0 && y < 18) { if (clicks.x.length > 1) { clicks.x = [x]; clicks.y = [y]; diff --git a/static/shared.js b/static/shared.js index 7a51e29..6d01e23 100644 --- a/static/shared.js +++ b/static/shared.js @@ -1,12 +1,12 @@ function renderMap(xx, yy) { - if (xx[0] > 0 && xx[0] < 31 && yy[0] > 0 && yy[0] < 9 && - xx[1] > 0 && xx[1] < 31 && yy[1] > 0 && yy[1] < 9 && + if (xx[0] > 0 && xx[0] < 37 && yy[0] > 0 && yy[0] < 18 && + xx[1] > 0 && xx[1] < 37 && yy[1] > 0 && yy[1] < 18 && xx[1] >= xx[0] && yy[1] >= yy[0]) { let grid = document.getElementById('mapgrid'); - grid.style.top = `${yy[0]*10}%`; - grid.style.left = `${100/31*xx[0]}%`; - grid.style.height = `${(yy[1] - yy[0] + 1) * 10}%`; - grid.style.width = `${100/31*(xx[1] - xx[0] + 1)}%`; + grid.style.top = `${yy[0]*100/18}%`; + grid.style.left = `${100/37*xx[0]}%`; + grid.style.height = `${(yy[1] - yy[0] + 1) * 100/18}%`; + grid.style.width = `${100/37*(xx[1] - xx[0] + 1)}%`; } else { alert(`invalid coordinates x=${xx} y=${yy}`); } @@ -26,8 +26,8 @@ function coordsToMap(coords_bl, coords_tr) { let bl_x = parseInt(coords_bl.slice(1)); let tr_x = parseInt(coords_tr.slice(1)); - bl_y = 8 - (bl_y.charCodeAt(0) - 65); - tr_y = 8 - (tr_y.charCodeAt(0) - 65); + bl_y = 16 - (bl_y.charCodeAt(0) - 65); + tr_y = 16 - (tr_y.charCodeAt(0) - 65); renderMap([bl_x, tr_x], [tr_y, bl_y]); -} \ No newline at end of file +} diff --git a/static/style.css b/static/style.css index be8a9bd..3b538ec 100644 --- a/static/style.css +++ b/static/style.css @@ -172,9 +172,9 @@ textarea { position: relative; border: 1px solid black; background: #fff; - max-width: 800px; + max-width: 1480px; max-height: 50vh; - aspect-ratio: 31 / 10; + aspect-ratio: 37 / 18; margin: 0 auto; } @@ -238,4 +238,4 @@ form #map { max-width: 100%; text-align: center; margin: auto; -} \ No newline at end of file +}