Erin Mulder on Wed Oct 12 11:48:02 2005


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[PhillyOnRails] Scriptaculous Drag & Drop Problem

  • From: meara@alumni.princeton.edu (Erin Mulder)
  • Subject: [PhillyOnRails] Scriptaculous Drag & Drop Problem
  • Date: Wed Oct 12 11:48:02 2005

Mark Chadwick wrote:
> Anyway, the hack is as follows:
> added a parameter "detached:true" to the Draggable constructor, which
> momentarily attaches the element to the body, and leaves a "shadow"
> behind while you're dragging.  It swaps things back in to place when its
> done.  Seems to work in Firefox and Safari.  Its a little bit hack-y
> right now, but maybe I'll clean it up to submit.

Okay... so this is similar to my clone-and-detach method (where I
adjusted startDrag and stopDrag to clone the element and then attach it
to body), but it has the same problem.  If you are scrolled down in the
scrollable div, the detached element shows up in the wrong place when
you start dragging.  (Basically, it uses the full offset instead of the
scrollview offset.)

That's how I ended up back at the ghosted solution, since it seemed to
handle the coordinates.  However, it's possible that we can find a way
to fix the detach approach.  Someone on the rails-spinoffs list just
mentioned that there's a "includeScrollOffsets" variable in
prototype.js.  We should look into that.

Of course, just about everything I've tried also acts horrible during
the revert, though I'm confident we can override that.

Here's a rails-spinoff thread that nicely sums up the problems.
http://wrath.rubyonrails.org/pipermail/rails-spinoffs/2005-September/000911.html

Thanks for helping -- I know we can solve this! :)

Cheers,
Erin