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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cm-chessboard",
3
- "version": "4.4.1",
3
+ "version": "4.4.2",
4
4
  "description": "A JavaScript chessboard which is lightweight, ES6 module based, responsive, SVG rendered and without dependencies.",
5
5
  "keywords": [
6
6
  "chess",
@@ -100,7 +100,7 @@ export class Position {
100
100
 
101
101
  movePiece(squareFrom, squareTo) {
102
102
  if(!this.squares[Position.squareToIndex(squareFrom)]) {
103
- console.error("movePiece, no piece on square", squareFrom)
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 (visible) {
314
- piece.setAttribute("visibility", "visible")
313
+ if(piece) {
314
+ if (visible) {
315
+ piece.setAttribute("visibility", "visible")
316
+ } else {
317
+ piece.setAttribute("visibility", "hidden")
318
+ }
315
319
  } else {
316
- piece.setAttribute("visibility", "hidden")
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.error("no piece found on", square)
330
+ console.warn("no piece on", square)
327
331
  }
328
332
  return piece
329
333
  }