From 12080960f4d111cd815a08a147be8da2b440ec43 Mon Sep 17 00:00:00 2001 From: Adrien MALINGREY Date: Sun, 3 Nov 2019 16:28:24 +0100 Subject: [PATCH] little changes --- css/themes/light-solid.css | 10 ++++++---- js/webtris.js | 20 +++++++++++--------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/css/themes/light-solid.css b/css/themes/light-solid.css index 47641ef..a8fa795 100644 --- a/css/themes/light-solid.css +++ b/css/themes/light-solid.css @@ -1,10 +1,12 @@ -.invisible-grid > .empty-cell { +.empty-cell { background: transparent; +} + +.invisible-grid > .empty-cell { border: 1px solid transparent; } .visible-grid > .empty-cell { - background: transparent; border: 1px inset rgba(128, 128, 128, 0.3); } @@ -53,11 +55,11 @@ .trail { background: rgba(255, 255, 255, 0.2); border: 1px solid rgba(255, 255, 255, 0.2); - border-radius: 0vmin; + border-radius: 0; } .ghost { background: rgba(255, 255, 255, 0.4); border: 1px solid rgba(255, 255, 255, 0.4); - border-radius: 0vmin; + border-radius: 0; } diff --git a/js/webtris.js b/js/webtris.js index 0d3f3fd..09f8417 100644 --- a/js/webtris.js +++ b/js/webtris.js @@ -301,14 +301,6 @@ class Matrix extends MinoesTable { this.drawMino(x, y, className) } } - - // trail - if (this.trail.height) { - this.trail.minoesPos.forEach(pos => { - for (var y = pos.y; y < pos.y + this.trail.height; y++) - this.drawMino(pos.x, y, CLASSNAME.TRAIL) - }) - } //ghost if (showGhost && !this.piece.locked && state != STATE.GAME_OVER) { @@ -318,6 +310,15 @@ class Matrix extends MinoesTable { } this.drawPiece(this.piece) + + // trail + if (this.trail.height) { + this.trail.minoesPos.forEach(pos => { + for (var y = pos.y; y < pos.y + this.trail.height; y++) + if (this.table.rows[y].cells[pos.x].className == CLASSNAME.EMPTY_CELL) + this.drawMino(pos.x, y, CLASSNAME.TRAIL) + }) + } } } } @@ -601,7 +602,7 @@ function gameOver() { removeEventListener("keydown", keyDownHandler, false) removeEventListener("keyup", keyUpHandler, false) - var info = `GAME OVER\nScore : ${stats.score}` + var info = `GAME OVER\nScore : ${stats.score.toLocaleString()}` if (stats.score == stats.highScore) { localStorage.setItem('highScore', stats.highScore) info += "\nBravo ! Vous avez battu votre précédent record." @@ -962,6 +963,7 @@ window.onload = function() { document.getElementById("startLevel").value = localStorage.getItem("startLevel") || 1 document.getElementById("startButton").disabled = false + document.getElementById("startButton").focus(); document.getElementById("settingsButton").disabled = false messageDiv = document.getElementById("message")