cm-chessboard 8.0.0 → 8.0.1

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/README.md CHANGED
@@ -88,26 +88,25 @@ Below is the default configuration
88
88
 
89
89
  ```javascript
90
90
  this.props = {
91
- position: FEN.empty, // set position as fen, use FEN.start or FEN.empty as shortcuts
92
- orientation: COLOR.white, // white on bottom
93
- responsive: true, // resize the board automatically to the size of the context element
94
- language: navigator.language.substring(0, 2).toLowerCase(), // supports "de" and "en" for now, used for pieces naming
95
- assetsUrl: "./assets/", // put all css and sprites in this folder, will be ignored for absolute urls of assets files
96
- assetsCache: true, // cache sprites
97
- style: {
98
- cssClass: "default", // set the css theme of the board, try "green", "blue" or "chess-club"
99
- showCoordinates: true, // show ranks and files
100
- borderType: BORDER_TYPE.none, // "thin" thin border, "frame" wide border with coordinates in it, "none" no border
101
- aspectRatio: 1, // height/width of the board
102
- pieces: {
103
- type: PIECES_FILE_TYPE.svgSprite, // pieces are in an SVG sprite, no other type supported for now
104
- file: "pieces/standard.svg", // the filename of the sprite in `assets/pieces/` or an absolute url like `https://…` or `/…`
105
- tileSize: 40 // the tile size in the sprite
91
+ position: FEN.empty, // set position as fen, use FEN.start or FEN.empty as shortcuts
92
+ orientation: COLOR.white, // white on bottom
93
+ responsive: true, // resize the board automatically to the size of the context element
94
+ language: navigator.language.substring(0, 2).toLowerCase(), // supports "de" and "en" for now, used for pieces naming
95
+ assetsUrl: "./assets/", // put all css and sprites in this folder, will be ignored for absolute urls of assets files
96
+ assetsCache: true, // cache sprites
97
+ style: {
98
+ cssClass: "default", // set the css theme of the board, try "green", "blue" or "chess-club"
99
+ showCoordinates: true, // show ranks and files
100
+ borderType: BORDER_TYPE.none, // "thin" thin border, "frame" wide border with coordinates in it, "none" no border
101
+ aspectRatio: 1, // height/width of the board
102
+ pieces: {
103
+ type: PIECES_FILE_TYPE.svgSprite, // pieces are in an SVG sprite, no other type supported for now
104
+ file: "pieces/standard.svg", // the filename of the sprite in `assets/pieces/` or an absolute url like `https://…` or `/…`
105
+ tileSize: 40 // the tile size in the sprite
106
+ },
107
+ animationDuration: 300 // pieces animation duration in milliseconds. Disable all animations with `0`
106
108
  },
107
- // pieces animation duration in milliseconds. Disable all animations with `0`. Respects the operating system settings for reduced motion.
108
- animationDuration: window.matchMedia("(prefers-reduced-motion: reduce)").matches ? 0 : 300
109
- },
110
- extensions: [ /* {class: ExtensionClass, props: { ... }} */] // add extensions here
109
+ extensions: [ /* {class: ExtensionClass, props: { ... }} */] // add extensions here
111
110
  }
112
111
  ```
113
112
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cm-chessboard",
3
- "version": "8.0.0",
3
+ "version": "8.0.1",
4
4
  "description": "A JavaScript chessboard which is lightweight, ES6 module based, responsive, SVG rendered and without dependencies.",
5
5
  "keywords": [
6
6
  "chess",
package/src/Chessboard.js CHANGED
@@ -70,8 +70,7 @@ export class Chessboard {
70
70
  file: "pieces/standard.svg", // the filename of the sprite in `assets/pieces/` or an absolute url like `https://…` or `/…`
71
71
  tileSize: 40 // the tile size in the sprite
72
72
  },
73
- // pieces animation duration in milliseconds. Disable all animations with `0`. Respects the operating system settings for reduced motion.
74
- animationDuration: window.matchMedia("(prefers-reduced-motion: reduce)").matches ? 0 : 300
73
+ animationDuration: 300 // pieces animation duration in milliseconds. Disable all animations with `0`
75
74
  },
76
75
  extensions: [ /* {class: ExtensionClass, props: { ... }} */] // add extensions here
77
76
  }
@@ -127,7 +127,7 @@ export class ChessboardView {
127
127
  this.redrawBoard()
128
128
  this.redrawPieces()
129
129
  }
130
- this.svg.setAttribute("width", "100%") // safari bugfix
130
+ this.svg.setAttribute("width", "100%")
131
131
  this.svg.setAttribute("height", "100%")
132
132
  }
133
133
 
@@ -244,6 +244,7 @@ export class VisualMoveInput {
244
244
  }
245
245
  if(e.type === "mousedown") { // another try to prevent strange safari desktop select all bug
246
246
  e.preventDefault()
247
+ e.stopPropagation()
247
248
  }
248
249
  const square = e.target.getAttribute("data-square")
249
250
  if (!square) { // pointer on square
@@ -317,6 +318,7 @@ export class VisualMoveInput {
317
318
  pageY = e.pageY
318
319
  target = e.target
319
320
  e.preventDefault() // trying to prevent strange safari desktop bug, selecting the whole page on drag
321
+ e.stopPropagation()
320
322
  } else if (e.type === "touchmove") {
321
323
  clientX = e.touches[0].clientX
322
324
  clientY = e.touches[0].clientY