From b9474e7ef170fd5dac842cadf52072e0a89f1bcb Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Fri, 26 May 2023 14:12:31 +0200 Subject: WIP map boxes and layout --- tools/genboxes.js | 58 ++++++++++++++++++++++++++++++++++++++++ tools/layout.svg | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 137 insertions(+) create mode 100644 tools/genboxes.js create mode 100644 tools/layout.svg (limited to 'tools') diff --git a/tools/genboxes.js b/tools/genboxes.js new file mode 100644 index 0000000..356955b --- /dev/null +++ b/tools/genboxes.js @@ -0,0 +1,58 @@ +const fs = require("fs") + +const { round, floor, ceil } = Math + +let boxes = {} +let mode, name, x, y, w, h, cx, cy, rx, ry + +function flush() { + if (mode === 'rect') { + boxes[name] = [ x, y, w, h ] + } + if (mode === 'circle') { + x = cx - rx + y = cy - ry + w = rx * 2 + h = ry * 2 + boxes[name] = [ x, y, w, h ] + } + x = y = w = h = cx = cy = rx = ry = 0 + name = null +} + +for (let line of fs.readFileSync("tools/layout.svg", "utf-8").split("\n")) { + line = line.trim() + if (line.startsWith(" + + + + + image/svg+xml + + + + + + + + + + + + -- cgit v1.2.3