From: Benjamin Auder Date: Tue, 31 Mar 2026 20:29:39 +0000 (+0200) Subject: Improve 8-pieces drawings X-Git-Url: https://git.auder.net/css/doc/html/%7B%7B%20path('fos_user_registration_register')%20%7D%7D?a=commitdiff_plain;p=xogo.git Improve 8-pieces drawings --- diff --git a/base_rules.js b/base_rules.js index 83a3c7b..daeb337 100644 --- a/base_rules.js +++ b/base_rules.js @@ -922,7 +922,7 @@ export default class ChessRules { e.preventDefault(); start = cd; curPiece = startPiece.cloneNode(); - curPiece.style.transform = "none"; + curPiece.style.translate = "0 0"; curPiece.style.zIndex = 5; curPiece.style.width = pieceWidth + "px"; curPiece.style.height = pieceWidth + "px"; diff --git a/pieces/Eightpieces/black_jailer.svg b/pieces/Eightpieces/black_jailer.svg index c79f44c..3324368 100644 --- a/pieces/Eightpieces/black_jailer.svg +++ b/pieces/Eightpieces/black_jailer.svg @@ -1,11 +1,11 @@ - - - - - - - + + + + + + + diff --git a/pieces/Eightpieces/black_lancer.svg b/pieces/Eightpieces/black_lancer.svg index 2156e03..60a06e3 100644 --- a/pieces/Eightpieces/black_lancer.svg +++ b/pieces/Eightpieces/black_lancer.svg @@ -1,8 +1,8 @@ - - - - + + + + diff --git a/pieces/Eightpieces/black_sentry.svg b/pieces/Eightpieces/black_sentry.svg index a3937d4..f3d963b 100644 --- a/pieces/Eightpieces/black_sentry.svg +++ b/pieces/Eightpieces/black_sentry.svg @@ -1,8 +1,8 @@ - - - - + + + + diff --git a/pieces/Eightpieces/white_jailer.svg b/pieces/Eightpieces/white_jailer.svg index 5e07c24..600ba2f 100644 --- a/pieces/Eightpieces/white_jailer.svg +++ b/pieces/Eightpieces/white_jailer.svg @@ -1,11 +1,11 @@ - - - - - - - + + + + + + + diff --git a/pieces/Eightpieces/white_lancer.svg b/pieces/Eightpieces/white_lancer.svg index 6273d6b..b8fe10a 100644 --- a/pieces/Eightpieces/white_lancer.svg +++ b/pieces/Eightpieces/white_lancer.svg @@ -1,8 +1,8 @@ - - - - + + + + diff --git a/pieces/Eightpieces/white_sentry.svg b/pieces/Eightpieces/white_sentry.svg index da6f197..3fd37b4 100644 --- a/pieces/Eightpieces/white_sentry.svg +++ b/pieces/Eightpieces/white_sentry.svg @@ -1,8 +1,8 @@ - - - - + + + + diff --git a/variants/Eightpieces/class.js b/variants/Eightpieces/class.js index 0627b64..527d2b0 100644 --- a/variants/Eightpieces/class.js +++ b/variants/Eightpieces/class.js @@ -68,6 +68,7 @@ export default class EightpiecesRules extends ChessRules { // TODO: FEN utils pushFrom et afterPush pieces(color, x, y) { + const mirror = (this.playerColor == 'b'); return Object.assign({ 'j': { "class": "jailer", @@ -83,49 +84,49 @@ export default class EightpiecesRules extends ChessRules { ] }, 'c': { - "class": "lancer_N", + "class": mirror ? "lancer_S" : "lancer_N", both: [ {steps: [[-1, 0]]} ] }, 'd': { - "class": "lancer_NE", + "class": mirror ? "lancer_SO" : "lancer_NE", both: [ {steps: [[-1, 1]]} ] }, 'e': { - "class": "lancer_E", + "class": mirror ? "lancer_O" : "lancer_E", both: [ {steps: [[0, 1]]} ] }, 'f': { - "class": "lancer_SE", + "class": mirror ? "lancer_NO" : "lancer_SE", both: [ {steps: [[1, 1]]} ] }, 'g': { - "class": "lancer_S", + "class": mirror ? "lancer_N" : "lancer_S", both: [ {steps: [[1, 0]]} ] }, 'h': { - "class": "lancer_SO", + "class": mirror ? "lancer_NE" : "lancer_SO", both: [ {steps: [[1, -1]]} ] }, 'm': { - "class": "lancer_O", + "class": mirror ? "lancer_E" : "lancer_O", both: [ {steps: [[0, -1]]} ] }, 'o': { - "class": "lancer_NO", + "class": mirror ? "lancer_SE" : "lancer_NO", both: [ {steps: [[-1, -1]]} ] diff --git a/variants/Eightpieces/style.css b/variants/Eightpieces/style.css index f49b54e..0ff0c7a 100644 --- a/variants/Eightpieces/style.css +++ b/variants/Eightpieces/style.css @@ -19,31 +19,31 @@ piece.white.lancer_N { } piece.white.lancer_NE { background-image: url('/pieces/Eightpieces/white_lancer.svg'); - transform: rotate(45deg); + rotate: 45deg; } piece.white.lancer_E { background-image: url('/pieces/Eightpieces/white_lancer.svg'); - transform: rotate(90deg); + rotate: 90deg; } piece.white.lancer_SE { background-image: url('/pieces/Eightpieces/white_lancer.svg'); - transform: rotate(135deg); + rotate: 135deg; } piece.white.lancer_S { background-image: url('/pieces/Eightpieces/white_lancer.svg'); - transform: rotate(180deg); + rotate: 180deg; } piece.white.lancer_SO { background-image: url('/pieces/Eightpieces/white_lancer.svg'); - transform: rotate(225deg); + rotate: 225deg; } piece.white.lancer_O { background-image: url('/pieces/Eightpieces/white_lancer.svg'); - transform: rotate(270deg); + rotate: 270deg; } piece.white.lancer_NO { background-image: url('/pieces/Eightpieces/white_lancer.svg'); - transform: rotate(315deg); + rotate: 315deg; } piece.black.lancer_N { @@ -51,29 +51,29 @@ piece.black.lancer_N { } piece.black.lancer_NE { background-image: url('/pieces/Eightpieces/black_lancer.svg'); - transform: rotate(45deg); + rotate: 45deg; } piece.black.lancer_E { background-image: url('/pieces/Eightpieces/black_lancer.svg'); - transform: rotate(90deg); + rotate: 90deg; } piece.black.lancer_SE { background-image: url('/pieces/Eightpieces/black_lancer.svg'); - transform: rotate(135deg); + rotate: 135deg; } piece.black.lancer_S { background-image: url('/pieces/Eightpieces/black_lancer.svg'); - transform: rotate(180deg); + rotate: 180deg; } piece.black.lancer_SO { background-image: url('/pieces/Eightpieces/black_lancer.svg'); - transform: rotate(225deg); + rotate: 225deg; } piece.black.lancer_O { background-image: url('/pieces/Eightpieces/black_lancer.svg'); - transform: rotate(270deg); + rotate: 270deg; } piece.black.lancer_NO { background-image: url('/pieces/Eightpieces/black_lancer.svg'); - transform: rotate(315deg); + rotate: 315deg; }