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 +18 -19
- package/package.json +1 -1
- package/src/Chessboard.js +1 -2
- package/src/view/ChessboardView.js +1 -1
- package/src/view/VisualMoveInput.js +2 -0
package/README.md
CHANGED
|
@@ -88,26 +88,25 @@ Below is the default configuration
|
|
|
88
88
|
|
|
89
89
|
```javascript
|
|
90
90
|
this.props = {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
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
|
-
|
|
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
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
|
|
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
|
}
|
|
@@ -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
|