summaryrefslogtreecommitdiff
path: root/game.js
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2024-08-22 23:46:23 -0400
committerpommicket <pommicket@gmail.com>2024-08-23 16:58:06 -0400
commit2cd2a3a6aa10546b0334187cb7f155f664760d43 (patch)
treeef5ce30e9318ad82d49af640f6633bdd737ad138 /game.js
parenta685c63f83bc12ac36d587c7c31ebf5dd170d5b4 (diff)
fix bug, adaptive border width
Diffstat (limited to 'game.js')
-rw-r--r--game.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/game.js b/game.js
index 4a90b48..ceea26d 100644
--- a/game.js
+++ b/game.js
@@ -260,7 +260,7 @@ window.addEventListener('load', function () {
svg.setAttribute('width', pieceWidth + 2 * nibSize);
svg.setAttribute('height', pieceHeight + 2 * nibSize);
svg.setAttribute('viewBox', `0 0 ${pieceWidth + 2 * nibSize} ${pieceHeight + 2 * nibSize}`);
- svg.innerHTML = `<path d="${clipPath}" stroke-width="1" stroke="black" fill="none" />`;
+ svg.innerHTML = `<path d="${clipPath}" stroke-width="${pieceWidth < 50 ? 1 : 2}" stroke="black" fill="none" />`;
this.element.style.backgroundPositionX = (nibSize - this.col() * pieceWidth) + 'px';
this.element.style.backgroundPositionY = (nibSize - this.row() * pieceHeight) + 'px';
}
@@ -611,7 +611,7 @@ window.addEventListener('load', function () {
});
const prevPlayAreaSize = Object.preventExtensions({width: playArea.clientWidth, height: playArea.clientHeight});
function everyFrame() {
- if (prevPlayAreaSize !== playArea.clientWidth || prevPlayAreaSize !== playArea.clientHeight) {
+ if (prevPlayAreaSize.width !== playArea.clientWidth || prevPlayAreaSize.height !== playArea.clientHeight) {
// disable animations while moving the pieces
for (const piece of pieces) {
piece.setAnimate(false);