- jessekeller wrote:
> I've got a y-scrolling div full of rows of images (up to 400 images).Go with 1. With 2, you're going to have to look at the other image
> The user needs to drag a new image into this div, and drop it into
> place. I figure there are two ways I can do this, but I don't know
> which is best:
> 1. Make every img in the target div a dragdrop target. On dragOver,
> figure out which side of the img we're on, then add an "insertion
> point" graphic in the appropriate place. This seems straightforward,
> but then I have hundreds of dropTargets, which seems intuitively wrong.
> 2. Make the target div itself a dragdrop target. On dragOver, use
> mouse and screen coords to figure out which two images to insert
> between, then add an "insertion point" graphic in the appropriate
> place. This reduces the number of dragdrop targets (to just one!) but
> greatly increases the complexity of figuring out where to drop.
elements anyway to see which ones you are inserting between, so, get the
Yahoo UI to at least point you at the right area.
A hint:. Set the YAHOO.util.DragDropMgr.mode to
YAHOO.util.DragDropMgr.INTERSECT so that it uses the intersection to
figure out which target you're on rather than the cursor position. (BTW,
Yahoo developers, the mode should surely be a flag in the DragDrop
object rather than the manager? It's too global being in the manager,
and affects all DragDrop elements on the page - not safe!)
The given target will be in the right row for the intersection, so then
just work out the x centre value of the target and the x centre value of
the drag element, and you'll see where to put your insertion point.
This message has been checked for all known viruses. Virus scanning
powered by Messagelabs http://www.messagelabs.com For more information
e-mail : hostmaster@...