blob: c739825fe2d247bc5fbf4e50f8f5cb50cee1f08e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
const data = require('../data.js')
const yoff = 1555
const xoff = 36
const hex_dx = 58.67
const hex_dy = 68
const hex_r = 56 >> 1
const CAPS = [ 1204, 1217, 1737, 2911, 3002, 3925 ]
var hex_x = []
var hex_y = []
for (let row = 0; row < data.map.rows; ++row) {
for (let col = 0; col < data.map.cols; ++col) {
let hex_id = 1000 + 100 * row + col
hex_x[hex_id] = Math.floor(xoff + hex_dx * (col + (row & 1) * 0.5 + 0.5))
hex_y[hex_id] = Math.floor(yoff - hex_dy * 3 / 4 * row + hex_dy/2)
}
}
for (let hex in data.map.names) {
hex = hex | 0
let name = data.map.names[hex]
let x = hex_x[hex] - 35
let y = hex_y[hex]
if (CAPS.includes(hex))
console.log(`<div class="label caps" style="left:${x}px;top:${y}px">${name}</div>`)
else
console.log(`<div class="label" style="left:${x}px;top:${y}px">${name}</div>`)
}
|