You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, just doing a fun little experiment project where I'm trying to create a basic card game. I was able to make the players hand draggable pretty easily and I was able to make the table area draggable as well.
I guess the question comes up the table has a certain amount of positions or slots where a card can be placed. Since I didn't see this lib having the concept of empty droppable zones I essentially masked my own by filling an array with N dummy empty items which I can render as empty "slots". DND is now working for it but since I'm now masking empty items to achieve this the next question is how do I do a replace instead of a insert, so when I drag a card onto the table it effectively slots itself into this position? Not sure if that's just bumping into a HTML5 DND limitation, but I'm open to creative ideas?
I see the performTransfer function which tbh it was not so obvious finding what to use to override how the card values will be set but it seems like this func might be too convoluted too since it's quite complicated and all I'm really needing/wanting to worry about is specifically how the target state gets updates and I'm thinking ideally intercepting the setState might make this feasible?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, just doing a fun little experiment project where I'm trying to create a basic card game. I was able to make the players hand draggable pretty easily and I was able to make the table area draggable as well.
I guess the question comes up the table has a certain amount of positions or slots where a card can be placed. Since I didn't see this lib having the concept of empty droppable zones I essentially masked my own by filling an array with N dummy empty items which I can render as empty "slots". DND is now working for it but since I'm now masking empty items to achieve this the next question is how do I do a replace instead of a insert, so when I drag a card onto the table it effectively slots itself into this position? Not sure if that's just bumping into a HTML5 DND limitation, but I'm open to creative ideas?
I see the
performTransfer
function which tbh it was not so obvious finding what to use to override how the card values will be set but it seems like this func might be too convoluted too since it's quite complicated and all I'm really needing/wanting to worry about is specifically how the target state gets updates and I'm thinking ideally intercepting the setState might make this feasible?Beta Was this translation helpful? Give feedback.
All reactions