react-chessboard-ui 1.4.7 → 1.4.9
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/ChessBoard/constants.d.ts +1 -0
- package/dist/index.js +10 -5
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +10 -5
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ChessBoardConfig } from "./models";
|
|
2
2
|
export declare const DEFAULT_CELL_SIZE = 92;
|
|
3
|
+
export declare const DEFAULT_FIGURE_SIZE_PERCENT = 80;
|
|
3
4
|
export declare const FACTOR_FOR_SIZE_CIRCLE_MARK = 4.6;
|
|
4
5
|
export declare const DEFAULT_CIRCLE_MARK_COLOR = "#3697ce";
|
|
5
6
|
export declare const DEFAULT_WHITE_CELL_COLOR = "#fafafc";
|
package/dist/index.js
CHANGED
|
@@ -1877,6 +1877,7 @@ var CHESS_PIECES_MAP = {
|
|
|
1877
1877
|
};
|
|
1878
1878
|
|
|
1879
1879
|
var DEFAULT_CELL_SIZE = 92;
|
|
1880
|
+
var DEFAULT_FIGURE_SIZE_PERCENT = 80;
|
|
1880
1881
|
var FACTOR_FOR_SIZE_CIRCLE_MARK = 4.6;
|
|
1881
1882
|
var DEFAULT_CIRCLE_MARK_COLOR = '#3697ce';
|
|
1882
1883
|
var DEFAULT_WHITE_CELL_COLOR = '#fafafc';
|
|
@@ -1889,6 +1890,7 @@ var DEFAULT_CHECKED_CELL_COLOR = '#e95b5c';
|
|
|
1889
1890
|
var DEFAULT_PIECES_MAP = CHESS_PIECES_MAP;
|
|
1890
1891
|
var DEFAULT_CHESSBORD_CONFIG = {
|
|
1891
1892
|
cellSize: DEFAULT_CELL_SIZE,
|
|
1893
|
+
figureSizePercent: DEFAULT_FIGURE_SIZE_PERCENT,
|
|
1892
1894
|
circleMarkColor: DEFAULT_CIRCLE_MARK_COLOR,
|
|
1893
1895
|
whiteCellColor: DEFAULT_WHITE_CELL_COLOR,
|
|
1894
1896
|
blackCellColor: DEFAULT_BLACK_CELL_COLOR,
|
|
@@ -2194,7 +2196,7 @@ var ChessBoardFiguresLayout = function ChessBoardFiguresLayout(props) {
|
|
|
2194
2196
|
width: boardConfig.cellSize,
|
|
2195
2197
|
height: boardConfig.cellSize
|
|
2196
2198
|
}
|
|
2197
|
-
}, boardConfig.piecesMap[getFigureCSS(figure)] && boardConfig.piecesMap[getFigureCSS(figure)](
|
|
2199
|
+
}, boardConfig.piecesMap[getFigureCSS(figure)] && boardConfig.piecesMap[getFigureCSS(figure)](boardConfig.figureSizePercent + "%"));
|
|
2198
2200
|
}));
|
|
2199
2201
|
};
|
|
2200
2202
|
|
|
@@ -2726,11 +2728,14 @@ var useChessBoardInteractive = function useChessBoardInteractive(props) {
|
|
|
2726
2728
|
var handleSelectFigurePicker = function handleSelectFigurePicker(figure) {
|
|
2727
2729
|
var startPos = fromPos[0] > -1 ? fromPos : clickedPos;
|
|
2728
2730
|
var updatedCells = JSChessEngine.transformPawnToFigure(actualState, startPos, targetPos, figure);
|
|
2731
|
+
var colorFEN = currentColor === 'white' ? 'black' : 'white';
|
|
2732
|
+
var FEN = stateToFEN(updatedCells, colorFEN);
|
|
2729
2733
|
var moveData = {
|
|
2730
2734
|
figure: figure,
|
|
2731
2735
|
from: startPos,
|
|
2732
2736
|
to: targetPos,
|
|
2733
|
-
type: 'transform'
|
|
2737
|
+
type: 'transform',
|
|
2738
|
+
FEN: FEN
|
|
2734
2739
|
};
|
|
2735
2740
|
onChange(moveData);
|
|
2736
2741
|
setActualState(updatedCells);
|
|
@@ -2814,7 +2819,7 @@ var HoldedFigure = function HoldedFigure(props) {
|
|
|
2814
2819
|
width: boardConfig.cellSize,
|
|
2815
2820
|
height: boardConfig.cellSize
|
|
2816
2821
|
}
|
|
2817
|
-
}, " ", boardConfig.piecesMap[getFigureCSS(holdedFigure)](
|
|
2822
|
+
}, " ", boardConfig.piecesMap[getFigureCSS(holdedFigure)](boardConfig.figureSizePercent + "%"));
|
|
2818
2823
|
};
|
|
2819
2824
|
|
|
2820
2825
|
var BASE_BOARD_SIZE$2 = 8;
|
|
@@ -2856,7 +2861,7 @@ var ChessBoardInteractiveLayout = function ChessBoardInteractiveLayout(props) {
|
|
|
2856
2861
|
width: boardConfig.cellSize,
|
|
2857
2862
|
height: boardConfig.cellSize
|
|
2858
2863
|
}
|
|
2859
|
-
}, boardConfig.piecesMap[getFigureCSS(holdedFigure)](
|
|
2864
|
+
}, boardConfig.piecesMap[getFigureCSS(holdedFigure)](boardConfig.figureSizePercent + "%")), checkIsPossibleMove(possibleMoves, [i, j]) && React__default.createElement("div", {
|
|
2860
2865
|
className: styles.possibleMoveMark,
|
|
2861
2866
|
style: {
|
|
2862
2867
|
width: boardConfig.cellSize / FACTOR_FOR_SIZE_CIRCLE_MARK,
|
|
@@ -2939,7 +2944,7 @@ var FigurePicker = function FigurePicker(props) {
|
|
|
2939
2944
|
onClick: function onClick() {
|
|
2940
2945
|
return handleChange(figure);
|
|
2941
2946
|
}
|
|
2942
|
-
}, boardConfig.piecesMap[getFigureCSS(figure)](
|
|
2947
|
+
}, boardConfig.piecesMap[getFigureCSS(figure)](boardConfig.figureSizePercent + "%"));
|
|
2943
2948
|
}));
|
|
2944
2949
|
};
|
|
2945
2950
|
|