Package Exports
- cm-chessboard
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (cm-chessboard) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
cm-chessboard
The chessboard for chessmail.eu / chessmail.de
Lightweight, SVG, ES6-module and almost no external dependencies.
Install
npm install
Configuration
With default values
this.config = {
initialPosition: "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1",
initialOrientation: 'white', // white on bottom
sprite: "../assets/sprite.svg", // figures and markers
spriteGrid: 40, // one figure every 40 px
responsive: false, // detect window resize
interactiveMoveMode: MOVE_MODE_LIVE, // type of interactive movement with mouse or tap
onBeforeMove: null, // callback, before interactive move, return true for ok
onAfterMove: null // callback after interactive move
};
API (not implemented yet)
fen(string fen)
- Set the position as fen
enableMoves(boolean enable)
- Enable interactive moving
callbacks
onBeforeMove(fieldFrom, fieldTo)
- Click oder drag allowed
onAfterMove(fieldFrom, fieldTo)
- Click oder drag allowed