react-chessboard-ui 0.2.2 → 0.2.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/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +3 -1
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2057,12 +2057,13 @@ var ChessBoardFiguresLayout = function ChessBoardFiguresLayout(props) {
|
|
|
2057
2057
|
if (attackedPos) return figure.position[0] === attackedPos[0] && figure.position[1] === attackedPos[1];
|
|
2058
2058
|
return figure.position[0] === to[0] && figure.position[1] === to[1];
|
|
2059
2059
|
});
|
|
2060
|
-
if (foundAttactedFigure) {
|
|
2060
|
+
if (foundAttactedFigure && foundAttactedFigure.color !== move.figure.color) {
|
|
2061
2061
|
foundAttactedFigure.color === 'white' ? foundAttactedFigure.position = [8, foundAttactedFigure.position[1]] : foundAttactedFigure.position = [-1, foundAttactedFigure.position[1]];
|
|
2062
2062
|
}
|
|
2063
2063
|
var foundFigureByPositionFrom = updatedState.find(function (figure) {
|
|
2064
2064
|
return figure.position[0] === from[0] && figure.position[1] === from[1];
|
|
2065
2065
|
});
|
|
2066
|
+
if (!foundFigureByPositionFrom) return updatedState;
|
|
2066
2067
|
foundFigureByPositionFrom.position = move.to;
|
|
2067
2068
|
if (!!transformTo) {
|
|
2068
2069
|
foundFigureByPositionFrom.type = transformTo.type;
|
|
@@ -2483,6 +2484,7 @@ var useChessBoardInteractive = function useChessBoardInteractive(props) {
|
|
|
2483
2484
|
if (withTransition === void 0) {
|
|
2484
2485
|
withTransition = false;
|
|
2485
2486
|
}
|
|
2487
|
+
if (clickedPos[0] === cellPos[0] && clickedPos[1] === cellPos[1]) return;
|
|
2486
2488
|
if (clickedPos[0] === -1) return;
|
|
2487
2489
|
if (!clickedFigure) return;
|
|
2488
2490
|
if (clickPossibleMoves.length === 0) return;
|