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

Specifying both fen and drawable.shapes does not actually show the shapes #171

Closed
DrPhil opened this issue Feb 13, 2021 · 2 comments
Closed

Comments

@DrPhil
Copy link

DrPhil commented Feb 13, 2021

If you specify both shapes and fen in the initial config, the fen is honored but the shapes are not rendered. I could reproduce this on both Firefox (version 85) and Chromium (version 88). I am using chessground 7.9.3.

Here's the code:

export const fromFen: Unit = {
  name: 'From FEN, from black POV without shapes',
  run(el) {
    return Chessground(el, {
      fen:'2r3k1/pp2Qpbp/4b1p1/3p4/3n1PP1/2N4P/Pq6/R2K1B1R w -',
      orientation: 'black'
    });
  }
};

export const fromFenWithShapes: Unit = {
  name: 'From FEN, from black POV with shapes',
  run(el) {
    return Chessground(el, {
      fen:'2r3k1/pp2Qpbp/4b1p1/3p4/3n1PP1/2N4P/Pq6/R2K1B1R w -',
      orientation: 'black',
      drawable: {shapes: [{
          orig: 'e4',
          brush: 'green'
        }]}
    });
  }
};

export const withoutFenWithShapes: Unit = {
  name: 'Without FEN, from black POV with shapes',
  run(el) {
    return Chessground(el, {
      orientation: 'black',
      drawable: {shapes: [{
          orig: 'e4',
          brush: 'green'
        }]}
    });
  }
};

Expected behavior: fromFenWithShapes looks the same as fromFen but with a green ring on e4.
Actual behavior: fromFenWithShapes looks identical to fromFen.

Specifying the shapes programmatically with setShapes works as expected.

image
image
image

@DrPhil
Copy link
Author

DrPhil commented Feb 13, 2021

I don't understand if it is intentional. Removing this line fixes the issue for me, but I don't know if anyone else is relying on the current behavior.

@ornicar
Copy link
Collaborator

ornicar commented Feb 14, 2021

The idea was probably that the previous shapes no longer make sense on a new position. Calling setShapes is the way to go.

@ornicar ornicar closed this as completed Feb 14, 2021
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

2 participants