b-tsao / bored-games

0 stars 0 forks source link

Drag discard #15

Open katsoohoo opened 4 years ago

katsoohoo commented 4 years ago

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.

b-tsao commented 4 years ago

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

kenwardt commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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

katsoohoo commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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

katsoohoo commented 4 years ago

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