[dojo-contributors] DnD constarined move: testers wanted!

Eugene Lazutkin eugene at lazutkin.com
Thu Jun 7 03:14:02 EDT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

First what's new. I checked in new enhancements:

1) dojo.dnd.Moveable

The constructor signature was changed. Previously it accepted two nodes:
the moveable node, and its optional handle. Now the second optional
argument is a dictionary. Following arguments are understood:

* handle - the old handle argument

* skip - skips starting the drag, if user moves mouse over form
elements. Useful, when user clicks buttons, select items, enters text,
and so on. The default is false.

* delay - the delay in pixels. User can drag mouse for "delay" pixels
until the drag is initiated. The default is 0.

* mover - JS class for the mover object, which is going to be created
when the drag is initiated. The default is dojo.dnd.Mover.

You can find examples of these arguments in action in
dojo/tests/dnd/test_opt_params.html. The "mover" argument is used for
custom movers --- see below.

2) dojo.dnd.Mover

Actually this is the old news: I switched it completely to
dojo.marginBox() by Scott J. Miles reducing the code, and keeping all
layout logic in one place.

3) dojo.dnd.constrainedMover

It takes a function, which returns a constraint box, and a boolean,
which indicates, if we want to constrained the whole object to the box
(when it is true), or just the top-left corner (when it is false). By
default the second parameter is false. The function is called every time
before initializing the corresponding dojo.dnd.Mover.
dojo.dnd.constrainedMover returns a function, which is used to create a
mover.

Two frequent cases of constraints are implemented:
dojo.dnd.boxConstrainedMover, and dojo.dnd.parentConstrainedMover.

There are three examples of constrained movers:

a) test_box_constraints.html --- shows how to restrict move to a
predefined box using dojo.dnd.boxConstrainedMover.

b) test_parent_constraints.html --- shows how to restrict move to a box
defined by node's parent using dojo.dnd.parentConstrainedMover.

c) test_custom_constraints.html --- shows how to restrict move to a
grid. The grid mover is created inline. The same way any arbitrary
restrictions can be implemented.

I didn't close #3224 yet because we need more testing. While Scott did
an outstanding job on dojo.marginBox() and several related functions, I
still see small glitches on different browsers like Opera 9. They are
not showstoppers, but still I want to iron them out. Please help us with
testing. If you find something reproducible, add a comment to #3224.

Thanks,

Eugene
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGZ7A6Y214tZwSfCsRAmFLAJ9CrNSRQAqkPhA4Cx4oBI/IpzF1sQCeJdIw
ba2ZgWcJOgK2w3YVfTgdaR0=
=dNBG
-----END PGP SIGNATURE-----



More information about the dojo-contributors mailing list