react-chessboard-ui 1.7.2 → 1.7.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.
|
@@ -46,7 +46,7 @@ export declare const useChessBoardInteractive: (props: UseChessBoardInteractiveP
|
|
|
46
46
|
moveFigureByChange: (change: ChangeMove) => void;
|
|
47
47
|
getHasCheckByCellPos: ([x, y]: CellPos) => boolean;
|
|
48
48
|
handleSelectFigurePicker: (figure: Figure) => void;
|
|
49
|
-
handleChangeFromExternal: (moveData: MoveData) => void;
|
|
49
|
+
handleChangeFromExternal: (moveData: MoveData, withTransition?: boolean) => void;
|
|
50
50
|
moveFigureByExternalChange: (from: CellPos, to: CellPos, figure: Figure) => {
|
|
51
51
|
moveData?: undefined;
|
|
52
52
|
attackedPos?: undefined;
|
package/dist/index.js
CHANGED
|
@@ -2650,10 +2650,13 @@ var useChessBoardInteractive = function useChessBoardInteractive(props) {
|
|
|
2650
2650
|
clearGrabbingPos();
|
|
2651
2651
|
clearPossibleMoves();
|
|
2652
2652
|
};
|
|
2653
|
-
var handleChangeFromExternal = function handleChangeFromExternal(moveData) {
|
|
2653
|
+
var handleChangeFromExternal = function handleChangeFromExternal(moveData, withTransition) {
|
|
2654
|
+
if (withTransition === void 0) {
|
|
2655
|
+
withTransition = true;
|
|
2656
|
+
}
|
|
2654
2657
|
var _moveFigureByExternal = moveFigureByExternalChange(moveData.from, moveData.to, moveData.figure),
|
|
2655
2658
|
attackedPos = _moveFigureByExternal.attackedPos;
|
|
2656
|
-
setAnimated(
|
|
2659
|
+
setAnimated(withTransition);
|
|
2657
2660
|
var change = {
|
|
2658
2661
|
move: moveData,
|
|
2659
2662
|
withTransition: true,
|
|
@@ -3007,6 +3010,7 @@ var ChessBoard = function ChessBoard(props) {
|
|
|
3007
3010
|
showFigurePicker = _useChessBoardInterac.showFigurePicker,
|
|
3008
3011
|
markCell = _useChessBoardInterac.markCell,
|
|
3009
3012
|
handleClick = _useChessBoardInterac.handleClick,
|
|
3013
|
+
setAnimated = _useChessBoardInterac.setAnimated,
|
|
3010
3014
|
handleGrabEnd = _useChessBoardInterac.handleGrabEnd,
|
|
3011
3015
|
handleGrabbing = _useChessBoardInterac.handleGrabbing,
|
|
3012
3016
|
endRenderArrow = _useChessBoardInterac.endRenderArrow,
|
|
@@ -3027,6 +3031,7 @@ var ChessBoard = function ChessBoard(props) {
|
|
|
3027
3031
|
boardState = _FENtoGameState.boardState,
|
|
3028
3032
|
currentColor = _FENtoGameState.currentColor;
|
|
3029
3033
|
cleanAllForFigure();
|
|
3034
|
+
setAnimated(false);
|
|
3030
3035
|
setInitialState(boardState);
|
|
3031
3036
|
setActualState(boardState);
|
|
3032
3037
|
setCurrentColor(currentColor);
|
|
@@ -3045,7 +3050,7 @@ var ChessBoard = function ChessBoard(props) {
|
|
|
3045
3050
|
React.useEffect(function () {
|
|
3046
3051
|
if (!change) return;
|
|
3047
3052
|
var reversedChange = reversed ? JSChessEngine.reverseMove(change.move) : change.move;
|
|
3048
|
-
handleChangeFromExternal(reversedChange);
|
|
3053
|
+
handleChangeFromExternal(reversedChange, change.withTransition);
|
|
3049
3054
|
}, [change]);
|
|
3050
3055
|
return React__default.createElement("div", {
|
|
3051
3056
|
className: styles.chessBoard
|