Drag and drop templates?

Are there any well-researched design patterns related to drag and drop gestures? Consider a canvas containing objects in a parent-child hierarchy with a specific location. Some objects can be dragged and dropped onto other objects using the mouse. In addition, objects can be modified and moved with the mouse.

Different hotspots on objects behave differently depending on the state of the user (drag and drop, selection). For a drag-and-drop operation, some elements are: 1) Visual user feedback for the original object 2) Visual user feedback while dragging 3) Drop zone detection 4) Drop compatibility tests 5) Drop action

The standard API tends to bundle these together into fairly monolithic code.

In addition, gestures such as moving and resizing have some common elements: 1) Visual feedback to the user when the mouse is in the resize / move area 2) Visual feedback during the move / resize operation 3) Completion / canceling the operation.

The question is, is there a way to do this that simplifies the code, separates responsibilities at the visual and document level, and perhaps much of that declarative?

Determining if the point under the mouse is the target transition point, for example, can use some form of hit testing in conjunction with the Chain of Responsibility pattern.

I believe there should be good design patterns that bring discipline and organization to this messy problem.

Greetings,

+2


source to share


1 answer


To answer my question, there is a very relevant discussion in chapter 2 of this book: http://www.amazon.com/gp/product/0596516258 .



However, this is still not as declarative or well taken into account as we would like.

+1


source







All Articles