Closed hslee2008 closed 1 year ago
Hi,
Regarding the chessboard issues:
<Chessboard position={...} />
(see documentation at https://kokopu-react.yo35.org/docs/current/#/Components/Chessboard). Typically you can pass a Position without the pieces you want to hide.<Chessboard flipped />
, right?Regarding a component for displaying taken pieces: Could be added to the lib, but you can also easily make that on your side. The URLs to the chess piece images are available as follows:
const pieceset = Chessboard.piecesets()['cburnett'];
pieceset.wk; // URL to the image representing a white king
pieceset.bq; // URL to the image representing a black queen
// ... etc
To clarify, by rotation. I mean when playing on phone, the player would the facing opposite sides.
So, in the image above, I want the top want to be what the white person is facing in real chess game.
Currently, using the flipped props will only move the pieces. Using CSS will achieve this, but dragging will be on opposite dirextion. But, I think it will be really useful if they could be entirely rotated like a really chess board.
Like this. But actually rotating the board like the 1st image will work. But, dragging will be done in opposite direction.
dragging will be done in opposite direction
I'm not sure to understand this point. If you rotate each image representing a chess piece, you should obtain what you want, isn't it? Dragging should work as expected in this case.
Two way to achieve that: either using CSS, or by providing a custom pieceset.
Sorry, I had been flipping the board on Y-Axis.
So, the X axis is normal. But, since the Y axis is flipped, it is dragged in opposite direction
https://github.com/yo35/kokopu-react/assets/78584173/4f11db0a-07e4-4fc5-81bb-cafa53dc4afb
<div className="flipped-mobile">
<Chessboard {...} />
</div>
.flipped-mobile {
transform: scaleY(-1);
}
Rotating 180deg is like flipping both x and y axis. So, it goes the opposite direction.
https://github.com/yo35/kokopu-react/assets/78584173/655ed283-bf39-4e59-a5ac-735552da612c
I am not sure exactly how to set my own piece set.
To clarify, if person B is black and person W is white, person B should not be able to edit the white pieces and vice versa.
I am not sure how to achieve this.
It might be possible using css, but I don't think there is any way of using css selectors to get only the black pieces or the white pieces to disable them by maybe user-select
.
I apologize if this is not the right way to approach it. This might be more closer to a discussion.
But I really want to achieve this feature where all the pieces are rotated.
If there is a way, could you tell me how to set my own custom piecesets? Also, a way to disable the pieces from being selected (black, white)
I'm suggesting not to flip the whole board, as you, but instead to flip each image representing a chess piece, individually. Thus, no dragging issues.
And I see two ways to achieve that: 1) through CSS, 2) by flipping each image manually and creating a new pieceset with the flipped versions:
Chessboard.piecesets()['cburnett_flipped'] = {
bk: /* URL to the flipped black king image */
bq: /* URL to the flipped black queen image */
... etc (see in https://github.com/yo35/kokopu-react/blob/master/src/chessboard/piecesets.ts
the list of images to set)
};
...
<Chessboard pieceset="cburnett_flipped" />
As of version 3.0.0 (just released), <Chessboard turnVisible={false} />
allows to hide the turn flag.
This version also adds a new component <ChessPieceIcon />
that can be used to display a list of chess pieces (e.g. the taken pieces). See documentation at: https://kokopu-react.yo35.org/docs/current/#/Components/ChessPieceIcon
Hi! I really love this project. It helped me make things. But I really wish there were some other features implemented.
Chessboard
Another component (taken pieces)