Not sure if I should post it here or in bugs section. Also, I was searching for same problems on forum and could not find it.
gameUi.dragBody function has a bug that can be observed easily in multipuck example. Start the multipack example, and make two pucks on table, move them so that they are exactly next to each other. Now click exactly between them (or try to drag them by clicking exactly between them). One of the pucks will be stuck on the table, and it can't be moved any more.
Reason for this bug is that "touch" event is sent to both pucks. Returning true in dragBody() function does not stop propagation of this event to another puck.
[I am not really sure if this is bug or a feature of event propagation mechanism. I guess it is feature, since I think returning true in handler only prevents event propagating to parent nodes in a tree, and since pucks are just siblings I guess this is expected behavior. Although it would be very nice if there is a way to stop event propagation to any other object. I hope someone can confirm if this is expected behavior of event propagation.]
So our dragBody() function is called for both pucks. Two joints will be created (one for each puck), but only the one puck will get the focus (the last one that received the event). Because only one puck has the focus, only that puck will receive the event when touch is over. So, only one physics joint gets removed, while the other puck is stuck on table forever, since its joint is never removed.
The best fix for this bug would be if we are able to stop propagation of events to any other objects. If this is not possible, another quick but ugly fix is to put global boolean variable in gameUi file, something like:
local isFocusSet = false
and to check this variable during "began" event phase in dragBody(). If it is set, then just return from dragBody(), since it means we are already dragging another object. If it is not set, then we add new joint, and set isFocusSet to true. Also, at the "ended" event phase we must reset isFocusSet to false.