Closed tom-anders closed 2 weeks ago
Related change, so I added it to this PR as well, as it will cause conflicts otherwise: Added possibility to flip all pieces (not just opponent pieces). This is also needed for the over the board implementation. Moved the variable from ChessboardState
to ChessboardSettings
as that felt like the more appropiate place to me (as it's a visual setting, not really about state):
I have one API change suggestion, cf comment.
I also think this deserves testing. Right now we don't test the upside down behavior, but with the new logic all the cases should be tested.
Piece widget should always return a
Transform.rotate
I think and we'd check the angle in tests to verify behavior.
Unfortunately, Transform.rotate
does not actually store the angle, but a matrix internally.
I went with checking the upsideDown
property of all pieces widgets, let me know if you think this is sufficient
Noticed this while building the "over the board" screen for lichess mobile v2. When pieces are flipped, the person dragging them will probably look at the app in such a way that the piece is not flipped from their POV. This means with the previous behavior, the drag feedback offset would be shifted into the wrong vertical direction.