cm-chessboard 4.4.1 → 4.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -100,7 +100,7 @@ export class Position {
|
|
|
100
100
|
|
|
101
101
|
movePiece(squareFrom, squareTo) {
|
|
102
102
|
if(!this.squares[Position.squareToIndex(squareFrom)]) {
|
|
103
|
-
console.
|
|
103
|
+
console.warn("no piece on", squareFrom)
|
|
104
104
|
return
|
|
105
105
|
}
|
|
106
106
|
this.squares[Position.squareToIndex(squareTo)] = this.squares[Position.squareToIndex(squareFrom)]
|
|
@@ -310,10 +310,14 @@ export class ChessboardView {
|
|
|
310
310
|
|
|
311
311
|
setPieceVisibility(square, visible = true) {
|
|
312
312
|
const piece = this.getPieceElement(square)
|
|
313
|
-
if
|
|
314
|
-
|
|
313
|
+
if(piece) {
|
|
314
|
+
if (visible) {
|
|
315
|
+
piece.setAttribute("visibility", "visible")
|
|
316
|
+
} else {
|
|
317
|
+
piece.setAttribute("visibility", "hidden")
|
|
318
|
+
}
|
|
315
319
|
} else {
|
|
316
|
-
|
|
320
|
+
console.warn("no piece on", square)
|
|
317
321
|
}
|
|
318
322
|
}
|
|
319
323
|
|
|
@@ -323,7 +327,7 @@ export class ChessboardView {
|
|
|
323
327
|
}
|
|
324
328
|
const piece = this.piecesGroup.querySelector(`g[data-square='${square}']`)
|
|
325
329
|
if (!piece) {
|
|
326
|
-
console.
|
|
330
|
+
console.warn("no piece on", square)
|
|
327
331
|
}
|
|
328
332
|
return piece
|
|
329
333
|
}
|