joshuaauerbachwatson / anyCards

Multi-person card game with no built-in rules
Apache License 2.0
0 stars 0 forks source link

[client] Ability to drag multiple cards at once (in a pile or overlapping) #8

Closed joshuaauerbachwatson closed 1 year ago

joshuaauerbachwatson commented 1 year ago

Suggested by Kai Jones (who was using the game in solitaire mode). Even in multiplayer mode it would be nice to be able to drag groups of cards that are not in a grid box.

joshuaauerbachwatson commented 1 year ago

The trick here is to disambiguate the different gestures so one knows whether it is a single card being dragged or a group. What I will try first is a general rule that when you drag a card (drag motion starts before a "tap" is indicated), you always drag every other card in the transitive closure of the "partially hides" relation. So, if you want to pull a single card out of a bunch that is overlapping, you have to tap it first (which will bring it to the top).

What gets left out of this scheme is the ability to drag a pile of cards that are densely piled (so that it is impossible to grab the bottommost card). For the moment, let's assume one would use a general box for this case (make a box, drag it, delete it).

joshuaauerbachwatson commented 1 year ago

An inhibitor to the present plan is the design of the TouchTapAndDragRecognizer and the way I am currently using it. Cards that are covered are brought to the top as soon as a touch is detected, which may be before the card is dragged. By the time the drag begins it is too late to undo this action.

I no longer understand the value of a pure "touch" handler. I think the recognizer should recognize only taps and drags and the decision of whether to bring the card to the front or flip it over should be made in the tap handler.

joshuaauerbachwatson commented 1 year ago

This is now implemented and seems to work. Could be reopened if flaws are found in the implementation.