On 7/5/07, Red <[EMAIL PROTECTED]> wrote: > Well, I'd want the same kind of snapping action that scriptaculous drag and > drop gives. I guess I could write a function that keeps calling itself to > slowly move the piece back. Not sure if this is the way to go. >
I think you're too focused on the revert in the "boolean" sense. The draggable effect takes into account the "delta" of the movement. If "revert" is set to true, it moves the element back to the original position based on the difference between where it started and where it is when you finish dragging. Take a look at the dragdrop.js file around line 423 - there's a method used called "currentDelta". You can see in that code how the revert uses that to move stuff back - that should help you to handle the revert if you need to without worrying about hacking your code to simulate the way scriptaculous already does it. > And now that I think about it, here's the issue with creating a list of > droppables for each piece. If I do that, the list for each piece has to be > updated with each and every move. Why for each piece? If I move a piece onto a square and 3 other pieces have that square in their list of "legal" moves, only those pieces affected would need to be updated rather than the whole set. --~--~---------~--~----~------------~-------~--~----~ 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 [email protected] 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 -~----------~----~----~----~------~----~------~--~---
