react-chessboard-expandable
Version:
A fork of the react-chessboard library to support an expandable chessboard
32 lines (31 loc) • 1.24 kB
TypeScript
import { BoardOrientation, BoardPosition, Square } from "./types";
/**
* Retrieves the coordinates at the centre of the requested square, relative to the top left of the board (0, 0).
*/
export declare function getRelativeCoords(boardOrientation: BoardOrientation, boardWidth: number, square: Square): {
x: number;
y: number;
};
/**
* Returns whether the passed position is different from the start position.
*/
export declare function isDifferentFromStart(newPosition: BoardPosition): boolean;
/**
* Returns what pieces have been added and what pieces have been removed between board positions.
*/
export declare function getPositionDifferences(currentPosition: BoardPosition, newPosition: BoardPosition): {
added: BoardPosition;
removed: BoardPosition;
};
/**
* Converts a fen string or existing position object to a position object.
*/
export declare function convertPositionToObject(position: string | BoardPosition): BoardPosition;
/**
* Converts a fen string to a position object.
* # - Marker for 8th row (if required)
* $ - Market for a file (if required)
*/
export declare function modifiedFenToObj(fen: string): [BoardPosition, {
[square in Square]: boolean;
}];