Hello,

Regarding dynapi-2.5.7 (latest stable copy I could find), I've been looking
at the code trying to figure out where to add some "snap-ability".  I've
worked out some partial snap logic which is illustrated in the attached
diagram.  This illustration includes a source layer (to be dragged), a
target layer (to snap to while dragging), a snap-border (to allow for a
flexible margin of error), and some coordinate logic to know whether or not
to snap.

My stumbling blocks at this point are three-fold:

1) Where to start adding new code?  In the dynapi/event/dragevent.js would
be my best guess.  What about the dynapi/ext/dragdrop.js (it doesn't seem to
have much in it).

2) How to get access to both the "source" and "target" while dragging?  In
dragevent.js, we have access to the event, but e.getSource() and
e.getTarget() both return the same object, the layer being dragged.

3) How to specify which draggable layers can snap, and to which layers they
can snap.

Regards,

Leif W

P.S. As I write, I also have inquiries in the back of my mind regarding more
complex "no-drag" zones and their boundaries.  For example, how to specify a
small region within a layer where blocks can't be dragged.  This is to
complement the "containment" boundaries that are already implemented.
Furthermore, after a drop event, how about the problem of repositioning
layers with respect to the target, and reassinging z-indexes of the newly
dropped and any previously "dropped" layers.  Would this involve any new
code, or is it already possible with existing DynLayer parent/child
relationships?

P.P.S. Thanks

<<attachment: Drag_Drop_Snap_-_Behavioural_Diagram.gif>>

Reply via email to