X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=public%2Fjavascripts%2Fcomponents%2Fboard.js;fp=public%2Fjavascripts%2Fcomponents%2Fboard.js;h=44c499c2030e8c7ef1072c94d3a3e840610c22aa;hb=baba60703f661aab20f2327098c3a0af572f0704;hp=cec6049eeebce78b1fb406f8428dd58b3f67fe7a;hpb=fd08ab2c5b8931bb8c95cf7e9f2f95122647f991;p=vchess.git diff --git a/public/javascripts/components/board.js b/public/javascripts/components/board.js index cec6049e..44c499c2 100644 --- a/public/javascripts/components/board.js +++ b/public/javascripts/components/board.js @@ -14,6 +14,8 @@ Vue.component('my-board', { }; }, render(h) { + if (!this.vr) + return; const [sizeX,sizeY] = [V.size.x,V.size.y]; // Precompute hints squares to facilitate rendering let hintSquares = doubleArray(sizeX, sizeY, false); @@ -21,6 +23,7 @@ Vue.component('my-board', { // Also precompute in-check squares let incheckSq = doubleArray(sizeX, sizeY, false); this.incheck.forEach(sq => { incheckSq[sq[0]][sq[1]] = true; }); + const squareWidth = 40; //TODO: compute this const choices = h( 'div', { @@ -85,7 +88,8 @@ Vue.component('my-board', { let cj = (this.orientation=='w' ? j : sizeY-j-1); let elems = []; if (this.vr.board[ci][cj] != V.EMPTY && (variant.name!="Dark" - || this.gameOver || this.vr.enlightened[this.userColor][ci][cj])) + || this.gameOver || this.mode == "analyze" + || this.vr.enlightened[this.userColor][ci][cj])) { elems.push( h( @@ -130,6 +134,7 @@ Vue.component('my-board', { 'dark-square': (i+j)%2==1, [this.bcolor]: true, 'in-shadow': variant.name=="Dark" && !this.gameOver + && this.mode != "analyze" && !this.vr.enlightened[this.userColor][ci][cj], 'highlight': showLight && !!lm && _.isMatch(lm.end, {x:ci,y:cj}), 'incheck': showLight && incheckSq[ci][cj],