Adjust squares size for bigger boards
authorBenjamin Auder <benjamin.auder@somewhere>
Tue, 27 Nov 2018 09:22:58 +0000 (10:22 +0100)
committerBenjamin Auder <benjamin.auder@somewhere>
Tue, 27 Nov 2018 09:22:58 +0000 (10:22 +0100)
public/javascripts/components/game.js
public/stylesheets/variant.sass

index 1b216ef..fcae2f1 100644 (file)
@@ -20,7 +20,7 @@ Vue.component('my-game', {
                };
        },
        render(h) {
-               let [sizeX,sizeY] = VariantRules.size;
+               const [sizeX,sizeY] = VariantRules.size;
                // Precompute hints squares to facilitate rendering
                let hintSquares = doubleArray(sizeX, sizeY, false);
                this.possibleMoves.forEach(m => { hintSquares[m.end.x][m.end.y] = true; });
@@ -127,7 +127,10 @@ Vue.component('my-game', {
                                this.choices.map( m => { //a "choice" is a move
                                        return h('div',
                                                {
-                                                       'class': { 'board': true },
+                                                       'class': {
+                                                               'board': true,
+                                                               ['board'+sizeX]: true,
+                                                       },
                                                        style: {
                                                                'width': (100/this.choices.length) + "%",
                                                                'padding-bottom': (100/this.choices.length) + "%",
@@ -137,7 +140,7 @@ Vue.component('my-game', {
                                                        {
                                                                attrs: { "src": '/images/pieces/' +
                                                                        VariantRules.getPpath(m.appear[0].c+m.appear[0].p) + '.svg' },
-                                                               'class': { 'choice-piece': true, 'board': true },
+                                                               'class': { 'choice-piece': true },
                                                                on: { "click": e => { this.play(m); this.choices=[]; } },
                                                        })
                                                ]
@@ -204,6 +207,7 @@ Vue.component('my-game', {
                                                                {
                                                                        'class': {
                                                                                'board': true,
+                                                                               ['board'+sizeX]: true,
                                                                                'light-square': (i+j)%2==0 && (this.expert || !highlight),
                                                                                'dark-square': (i+j)%2==1 && (this.expert || !highlight),
                                                                                'highlight': !this.expert && highlight,
index 7e530f6..e28bc84 100644 (file)
@@ -71,15 +71,24 @@ figure.diagram-container > .diagram
 .black-turn
   background-color: black
 
-// TODO: div.board, board9, board10, board11, board12
 div.board
   float: left
-  width: 12.5%
   height: 0
-  padding-bottom: 12.5%
   display: inline-block
   position: relative
 
+div.board8
+  width: 12.5%
+  padding-bottom: 12.5%
+
+div.board10
+  width: 10%
+  padding-bottom: 10%
+
+div.board11
+  width: 9.1%
+  padding-bottom: 9.1%
+
 .game
   clear: both