cm-chessboard 3.16.6 → 3.16.9

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": "3.16.6",
3
+ "version": "3.16.9",
4
4
  "description": "A JavaScript chessboard which is lightweight, ES6 module based, responsive, SVG rendered and without dependencies.",
5
5
  "keywords": [
6
6
  "chess",
@@ -148,7 +148,7 @@ export class ChessboardMoveInput {
148
148
  })
149
149
  } else {
150
150
  this.view.drawPieces(this.chessboard.state.squares)
151
- this.view.animationQueue.shift()
151
+ // this.view.animationQueue = [] // todo remove all animations (See PR #59)
152
152
  this.setMoveInputState(STATE.reset)
153
153
  }
154
154
  } else {
@@ -104,8 +104,14 @@ export class ChessboardView {
104
104
  Svg.removeElement(this.svg)
105
105
  }
106
106
  this.svg = Svg.createSvg(this.chessboard.element)
107
+ let description = document.createElement("description")
108
+ description.innerText = "Chessboard"
109
+ description.id = "svg-description"
110
+ this.svg.appendChild(description)
107
111
  let cssClass = this.chessboard.props.style.cssClass ? this.chessboard.props.style.cssClass : "default"
108
112
  this.svg.setAttribute("class", "cm-chessboard border-type-" + this.chessboard.props.style.borderType + " " + cssClass)
113
+ this.svg.setAttribute("aria-describedby", "svg-description")
114
+ this.svg.setAttribute("role", "img")
109
115
  this.updateMetrics()
110
116
  this.boardGroup = Svg.addElement(this.svg, "g", {class: "board"})
111
117
  this.coordinatesGroup = Svg.addElement(this.svg, "g", {class: "coordinates"})
@@ -335,13 +341,21 @@ export class ChessboardView {
335
341
  nextPieceAnimationInQueue() {
336
342
  const nextAnimation = this.animationQueue.shift()
337
343
  if (nextAnimation !== undefined) {
338
- this.drawPieces(nextAnimation.fromSquares)
339
344
  this.animationRunning = true
340
345
  this.currentAnimation = new ChessboardPiecesAnimation(this, nextAnimation.fromSquares, nextAnimation.toSquares, this.chessboard.props.animationDuration / (this.animationQueue.length + 1), () => {
341
- this.animationRunning = false
342
- this.nextPieceAnimationInQueue()
343
- if (nextAnimation.callback) {
344
- nextAnimation.callback()
346
+ if (!this.moveInput.draggablePiece) {
347
+ this.drawPieces(nextAnimation.toSquares)
348
+ this.animationRunning = false
349
+ this.nextPieceAnimationInQueue()
350
+ if (nextAnimation.callback) {
351
+ nextAnimation.callback()
352
+ }
353
+ } else {
354
+ this.animationRunning = false
355
+ this.nextPieceAnimationInQueue()
356
+ if (nextAnimation.callback) {
357
+ nextAnimation.callback()
358
+ }
345
359
  }
346
360
  })
347
361
  }