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.
@@ -2054,12 +2054,13 @@ var ChessBoardFiguresLayout = function ChessBoardFiguresLayout(props) {
2054
2054
  if (attackedPos) return figure.position[0] === attackedPos[0] && figure.position[1] === attackedPos[1];
2055
2055
  return figure.position[0] === to[0] && figure.position[1] === to[1];
2056
2056
  });
2057
- if (foundAttactedFigure) {
2057
+ if (foundAttactedFigure && foundAttactedFigure.color !== move.figure.color) {
2058
2058
  foundAttactedFigure.color === 'white' ? foundAttactedFigure.position = [8, foundAttactedFigure.position[1]] : foundAttactedFigure.position = [-1, foundAttactedFigure.position[1]];
2059
2059
  }
2060
2060
  var foundFigureByPositionFrom = updatedState.find(function (figure) {
2061
2061
  return figure.position[0] === from[0] && figure.position[1] === from[1];
2062
2062
  });
2063
+ if (!foundFigureByPositionFrom) return updatedState;
2063
2064
  foundFigureByPositionFrom.position = move.to;
2064
2065
  if (!!transformTo) {
2065
2066
  foundFigureByPositionFrom.type = transformTo.type;
@@ -2480,6 +2481,7 @@ var useChessBoardInteractive = function useChessBoardInteractive(props) {
2480
2481
  if (withTransition === void 0) {
2481
2482
  withTransition = false;
2482
2483
  }
2484
+ if (clickedPos[0] === cellPos[0] && clickedPos[1] === cellPos[1]) return;
2483
2485
  if (clickedPos[0] === -1) return;
2484
2486
  if (!clickedFigure) return;
2485
2487
  if (clickPossibleMoves.length === 0) return;