Actually, it's a bit more complicated than that...

I have a div (we'll call it the "portal") of a fixed size and absolute
positioning, with an overflow: scroll set. Inside, I have a container
div with relative positioning. This inner container has a series of
absolutely-positioned elements which are draggable with a vertical
constraint. The height of the container is several times greater than
the "portal".

I needed to drag these elements outside the "portal". If I just made
the elements draggable, when I got to the boundary of the portal, the
elements would disappear on the inside. I solved this by moving the
element to the portal's parent container in the onStart handler (while
keeping track of the original container so that I could put it back on
the onEnd handler. The problem I encountered was when I was dragging
elements that required me to scroll down on the inner container. When
they came out of the portal, their "top" property was set relative to
the inner container. For whatever reason, the event passed to me
didn't contain any mouse coordinates, nor was I able to get the scroll
distance of the container.

I ended up keeping track of the mouse coordinates at all times with a
"mousemove" event on the document element. I added an onDrag handler
to position the element using the mouse coords I was getting. The
problem with doing this was that in dragdrop.js, in the draw method of
Draggable, it constantly overwrites the top property with its own
calculation which does not work at all in what I needed to do. The
only way around this I could find was to disable the 'style.top = p[1]
+ "px"' (lines 493-494 in v1.8.1 of dragdrop.js).

I'm not sure if there is a more elegant way to do this, or if there
should be some sort of hook so a developer can use a callback function
to calculate the new coordinates, but I did want to share my solution
to the problem in case anyone else encountered it.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to rubyonrails-spinoffs@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to