Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Positional notation (piece@square) broken #10

Closed
jniemann66 opened this issue Apr 23, 2017 · 1 comment
Closed

Positional notation (piece@square) broken #10

jniemann66 opened this issue Apr 23, 2017 · 1 comment

Comments

@jniemann66
Copy link
Owner

In the absence of fen and pgn props, chessdiagram should simply draw a blank board, or otherwise accept an array of piece@square values via the pieces prop.

However, internal movelist is being populated in the constructor (via the getFensFromPgn() function).

proposed fix (chessdiagram.js, starting line 38):

	        // If FEN is present, and it is an array, use it for moves
		// If FEN is present, and it is a string, make it the first element of the moves array.
		// If FEN is NOT present, and PGN is present, call getFensFromPgn() to generate an array of FENs 
		// If FEN is NOT present, and PGN is NOT present, make first element of moves array an empty string
		const moves = props.fen ?
			Array.isArray(props.fen) ? props.fen : [props.fen]
			: props.pgn ? props.getFensFromPgn(props.pgn) : '';

		// If there is a PGN, set currentMove to this.startMove, otherwise zero.	
		const currentMove = props.pgn ? this.startMove : 0;

jniemann66 added a commit that referenced this issue Apr 23, 2017
@jniemann66
Copy link
Owner Author

fixed in 19eadb5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant