cm-chessboard 8.4.0 → 8.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": "8.4.0",
3
+ "version": "8.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",
@@ -23,7 +23,9 @@ export class ChessboardView {
23
23
  if (chessboard.props.responsive) {
24
24
  if (typeof ResizeObserver !== "undefined") {
25
25
  this.resizeObserver = new ResizeObserver(() => {
26
- this.handleResize()
26
+ setTimeout(() => { // prevents "ResizeObserver loop completed with undelivered notifications."
27
+ this.handleResize()
28
+ })
27
29
  })
28
30
  this.resizeObserver.observe(this.chessboard.context)
29
31
  } else {
@@ -37,6 +39,7 @@ export class ChessboardView {
37
39
  this.container.addEventListener("mousedown", this.pointerDownListener)
38
40
  this.container.addEventListener("touchstart", this.pointerDownListener, {passive: false})
39
41
  this.createSvgAndGroups()
42
+ this.handleResize()
40
43
  }
41
44
 
42
45
  pointerDownHandler(e) {
@@ -252,8 +255,8 @@ export class ChessboardView {
252
255
  const pieceGroup = Svg.addElement(this.piecesGroup, "g", {})
253
256
  pieceGroup.setAttribute("data-piece", pieceName)
254
257
  pieceGroup.setAttribute("data-square", square)
255
- if(hidden) {
256
- pieceGroup.setAttribute("visibility","hidden")
258
+ if (hidden) {
259
+ pieceGroup.setAttribute("visibility", "hidden")
257
260
  }
258
261
  const point = this.squareToPoint(square)
259
262
  const transform = (this.svg.createSVGTransform())
@@ -431,7 +434,7 @@ export class ChessboardView {
431
434
  }
432
435
 
433
436
  getSpriteUrl() {
434
- if(Utils.isAbsoluteUrl(this.chessboard.props.style.pieces.file)) {
437
+ if (Utils.isAbsoluteUrl(this.chessboard.props.style.pieces.file)) {
435
438
  return this.chessboard.props.style.pieces.file
436
439
  } else {
437
440
  return this.chessboard.props.assetsUrl + this.chessboard.props.style.pieces.file