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

Drag discard #15

Open
katsoohoo opened this issue May 28, 2020 · 10 comments
Open

Drag discard #15

katsoohoo opened this issue May 28, 2020 · 10 comments
Labels
client enhancement New feature or request mahjong

Comments

@katsoohoo
Copy link
Collaborator

Ideally, I would like some hover effect and one-click to discard, but then we would have to change how to select kongs and claims.

@katsoohoo katsoohoo added enhancement New feature or request mahjong labels May 28, 2020
@b-tsao b-tsao changed the title Double-click discard Drag discard May 29, 2020
@b-tsao
Copy link
Owner

b-tsao commented May 29, 2020

After the discussion today, the solution will be to drag the tile to the center discard box to confirm discard.

@kenwardt
Copy link
Contributor

Can I install packages to handle drag-and-drop? or is there existing code I'm supposed to build from for this feature?

@b-tsao
Copy link
Owner

b-tsao commented May 29, 2020

What package do you have in mind?

Keep in mind, it's not true drag & drag, the user clicks the tile, holds the mouse and lets go in the discard box, but there's no real file transfer here. We only need to detect that the user did the action above and send the tile (idx of tile in the hand) that was "Dragged" to the server.

@b-tsao
Copy link
Owner

b-tsao commented May 29, 2020

This can be done via detecting the mouse down event, detecting the mouse up event, transitioning the object at the cursor pos while mouse is down.

@kenwardt
Copy link
Contributor

I've had the best success with react-beautiful-dnd in terms of the best animations and fluidity. Mostly used for list DND but probably can be used for games like this example.

@b-tsao
Copy link
Owner

b-tsao commented May 29, 2020

Hmm, pretty heavy at 1.39 MB if we only use it for this though. @katsoohoo what do you think?

@katsoohoo
Copy link
Collaborator Author

katsoohoo commented May 29, 2020

I'm open to any drag/drop implementation. One concern is that during the discard stage, the player can choose to discard or kong. If we want to do drag/drop to discard, we have to make sure it doesn't conflict with selecting tiles for kong or have a different flow for kong in the hand.

@b-tsao
Copy link
Owner

b-tsao commented May 29, 2020

To make it consistent with the other flows, if the player can kong, the UI should show them the possible kong options and allow them to select it.

@b-tsao
Copy link
Owner

b-tsao commented May 29, 2020

Probably don't need to manually select tiles for claiming anymore.

@katsoohoo
Copy link
Collaborator Author

Yes, manual select should be phased out once we can determine possible claims and kongs from the server.

@kenwardt kenwardt removed their assignment Jun 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client enhancement New feature or request mahjong
Projects
None yet
Development

No branches or pull requests

3 participants