display items on map, switch to grid layout

closes #2
This commit is contained in:
jomo 2022-08-05 22:04:56 +02:00
parent fda7352e22
commit 8e19a1dbad
6 changed files with 151 additions and 42 deletions

View file

@ -2,7 +2,7 @@ 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 &&
xx[1] >= xx[0] && yy[1] >= yy[0]) {
let grid = document.getElementById('grid');
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}%`;
@ -12,6 +12,14 @@ function renderMap(xx, yy) {
}
}
function clearMap() {
const mapnote = document.getElementById('mapnote');
if (mapnote) {
mapnote.textContent = '';
}
document.getElementById('mapgrid').removeAttribute('style');
}
function coordsToMap(coords_bl, coords_tr) {
let bl_y = coords_bl[0];
let tr_y = coords_tr[0];