cm-chessboard 8.0.0 → 8.0.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/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.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",
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
 
@@ -242,9 +242,6 @@ export class VisualMoveInput {
242
242
  if (!(e.type === "mousedown" && e.button === 0 || e.type === "touchstart")) {
243
243
  return
244
244
  }
245
- if(e.type === "mousedown") { // another try to prevent strange safari desktop select all bug
246
- e.preventDefault()
247
- }
248
245
  const square = e.target.getAttribute("data-square")
249
246
  if (!square) { // pointer on square
250
247
  return
@@ -316,7 +313,6 @@ export class VisualMoveInput {
316
313
  pageX = e.pageX
317
314
  pageY = e.pageY
318
315
  target = e.target
319
- e.preventDefault() // trying to prevent strange safari desktop bug, selecting the whole page on drag
320
316
  } else if (e.type === "touchmove") {
321
317
  clientX = e.touches[0].clientX
322
318
  clientY = e.touches[0].clientY