cm-chessboard 3.16.2 → 3.16.3
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 +1 -1
- package/src/cm-chessboard/Chessboard.js +11 -11
package/package.json
CHANGED
|
@@ -40,7 +40,7 @@ export const FEN_EMPTY_POSITION = "8/8/8/8/8/8/8/8"
|
|
|
40
40
|
|
|
41
41
|
export class Chessboard {
|
|
42
42
|
|
|
43
|
-
constructor(element, props = {}) {
|
|
43
|
+
constructor(element, props = {}) { // TODO rename element to context
|
|
44
44
|
if (!element) {
|
|
45
45
|
throw new Error("container element is " + element)
|
|
46
46
|
}
|
|
@@ -120,17 +120,17 @@ export class Chessboard {
|
|
|
120
120
|
const pieceFrom = this.getPiece(squareFrom)
|
|
121
121
|
if(!pieceFrom) {
|
|
122
122
|
reject("no piece on square " + squareFrom)
|
|
123
|
-
return
|
|
124
|
-
}
|
|
125
|
-
this.state.squares[this.state.squareToIndex(squareFrom)] = null
|
|
126
|
-
this.state.squares[this.state.squareToIndex(squareTo)] = pieceFrom
|
|
127
|
-
if (animated) {
|
|
128
|
-
this.view.animatePieces(prevSquares, this.state.squares, () => {
|
|
129
|
-
resolve()
|
|
130
|
-
})
|
|
131
123
|
} else {
|
|
132
|
-
this.
|
|
133
|
-
|
|
124
|
+
this.state.squares[this.state.squareToIndex(squareFrom)] = null
|
|
125
|
+
this.state.squares[this.state.squareToIndex(squareTo)] = pieceFrom
|
|
126
|
+
if (animated) {
|
|
127
|
+
this.view.animatePieces(prevSquares, this.state.squares, () => {
|
|
128
|
+
resolve()
|
|
129
|
+
})
|
|
130
|
+
} else {
|
|
131
|
+
this.view.drawPieces(this.state.squares)
|
|
132
|
+
resolve()
|
|
133
|
+
}
|
|
134
134
|
}
|
|
135
135
|
})
|
|
136
136
|
}
|