From e5d7ae7c48380b1f8825b58459c0fbd5fce25c7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Hru=C5=A1ka?= Date: Sat, 7 Dec 2019 17:48:53 +0100 Subject: [PATCH] tweak some svg attribs --- .idea/workspace.xml | 8 +- images/orb-metal-inksc.svg | 284 +++++++++++++++++++++++++++++++++++++ index.html | 2 +- script.js | 11 +- 4 files changed, 297 insertions(+), 8 deletions(-) create mode 100644 images/orb-metal-inksc.svg diff --git a/.idea/workspace.xml b/.idea/workspace.xml index bc9527b..030250d 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,11 +2,9 @@ - - \ No newline at end of file diff --git a/images/orb-metal-inksc.svg b/images/orb-metal-inksc.svg new file mode 100644 index 0000000..64106e7 --- /dev/null +++ b/images/orb-metal-inksc.svg @@ -0,0 +1,284 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + diff --git a/index.html b/index.html index 11474d9..28423bc 100644 --- a/index.html +++ b/index.html @@ -12,7 +12,7 @@
- diff --git a/script.js b/script.js index 481fa38..0f301ec 100644 --- a/script.js +++ b/script.js @@ -16,6 +16,7 @@ class Board { constructor() { this.$boardbg = document.getElementById('boardbg'); this.$orbs = document.getElementById('orbs'); + this.$svg = document.getElementById('board'); this.initOrb(); this.initGlyphs(); @@ -86,6 +87,12 @@ class Board { o.classList.add('highlight'); } + highlight(symbol=null) { + if (symbol !== null) { + //this.$svg + } + } + xyToIndex(x, y) { return y * 11 + x } @@ -94,8 +101,8 @@ class Board { const gap = 6; const xstep = 86+gap; const ystep = 75+gap; - const xbase = 370; - const ybase = 90; + const xbase = (this.$svg.getAttribute('width') - 5.5 * ystep - gap*2) / 2; + const ybase = (this.$svg.getAttribute('height') - 10 * ystep - gap*2) / 2; let rx = xbase + xstep * x - y*Math.floor(xstep/2); let ry = ybase + ystep * y;