cm-chessboard 5.2.0 → 5.2.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.
|
@@ -36,7 +36,7 @@ function inputHandler(event) {
|
|
|
36
36
|
if (result) {
|
|
37
37
|
event.chessboard.disableMoveInput()
|
|
38
38
|
this.chessboard.state.moveInputProcess.then(() => { // wait for the move input process has finished
|
|
39
|
-
this.chessboard.setPosition(chess.fen(), true).then(() => { // wait for animation has finished
|
|
39
|
+
this.chessboard.setPosition(chess.fen(), true).then(() => { // update position, maybe castled and wait for animation has finished
|
|
40
40
|
const possibleMoves = chess.moves({verbose: true})
|
|
41
41
|
if (possibleMoves.length > 0) {
|
|
42
42
|
const randomIndex = Math.floor(Math.random() * possibleMoves.length)
|
|
@@ -47,7 +47,7 @@ function inputHandler(event) {
|
|
|
47
47
|
event.chessboard.setPosition(chess.fen(), true)
|
|
48
48
|
}, 500)
|
|
49
49
|
}
|
|
50
|
-
})
|
|
50
|
+
})
|
|
51
51
|
})
|
|
52
52
|
} else {
|
|
53
53
|
console.warn("invalid move", move)
|
|
@@ -86,7 +86,7 @@ board.enableMoveInput(inputHandler, COLOR.white)
|
|
|
86
86
|
if (result) {
|
|
87
87
|
event.chessboard.disableMoveInput()
|
|
88
88
|
this.chessboard.state.moveInputProcess.then(() => { // wait for the move input process has finished
|
|
89
|
-
this.chessboard.setPosition(chess.fen(), true).then(() => { // wait for animation has finished
|
|
89
|
+
this.chessboard.setPosition(chess.fen(), true).then(() => { // update position, maybe castled and wait for animation has finished
|
|
90
90
|
const possibleMoves = chess.moves({verbose: true})
|
|
91
91
|
if (possibleMoves.length > 0) {
|
|
92
92
|
const randomIndex = Math.floor(Math.random() * possibleMoves.length)
|
|
@@ -97,7 +97,7 @@ board.enableMoveInput(inputHandler, COLOR.white)
|
|
|
97
97
|
event.chessboard.setPosition(chess.fen(), true)
|
|
98
98
|
}, 500)
|
|
99
99
|
}
|
|
100
|
-
})
|
|
100
|
+
})
|
|
101
101
|
})
|
|
102
102
|
} else {
|
|
103
103
|
console.warn("invalid move", move)
|