Johnny
2006-Nov-16 15:07 UTC
Scriptaculous, can you put a delay reverting a drag and drop draggable?
Hi, I have a simple drag and drop interface, I was wondering does anyone know how to apply a delay time for a draggable to revert, I want them to revert to their original position but after a delay time at the moment I have this: new Draggable(''drag_oject1'', {revert:true}); the above makes the draggable revert immedialty on drop. I want something like this: new Draggable(''drag_oject1'', {revert:function(){delay:500; return true}}); but that doesnt work as I expected, it just applys the delay to the start of the drag action. Im still fairly green on javascript in general so any help would be appreciated! --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Christophe Porteneuve
2006-Nov-18 16:14 UTC
Re: Scriptaculous, can you put a delay reverting a drag and drop draggable?
Hey Johnny, Johnny a écrit :> Hi, I have a simple drag and drop interface, I was wondering does > anyone know how to apply a delay time for a draggable to revert, I want > them to revert to their original position but after a delay timeThere''s no such thing in there for now. The reverteffect function, which by default triggers a properly-configured Effect.Move, has no hooks for delaying. There is room for a rather ugly hack, relying on undocumented parts of the code, that would involve a global onEnd draggable listener pushing a delay-creating effect on the /private/ "_draggable" queue, if it''s detecting drag end on your element. Since the code will trigger revert after that, and will by default push the Effect.Move on this queue, you should attain your goal. But that''s going out on a limb: script.aculo.us might very well implement things otherwise in the future. -- Christophe Porteneuve a.k.a. TDD "[They] did not know it was impossible, so they did it." --Mark Twain Email: tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Johnny
2006-Nov-18 20:59 UTC
Re: Scriptaculous, can you put a delay reverting a drag and drop draggable?
Ok, thanks for the reply. Thankfully its not mission critical so I might just add it to the scriptaculous wish list instead of writing in a nasty hack. On Nov 18, 4:14 pm, Christophe Porteneuve <t...-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org> wrote:> Hey Johnny, > > Johnny a écrit : > > > Hi, I have a simple drag and drop interface, I was wondering does > > anyone know how to apply a delay time for a draggable to revert, I want > > them to revert to their original position but after a delay timeThere''s no such thing in there for now. The reverteffect function, > which by default triggers a properly-configured Effect.Move, has no > hooks for delaying. > > There is room for a rather ugly hack, relying on undocumented parts of > the code, that would involve a global onEnd draggable listener pushing a > delay-creating effect on the /private/ "_draggable" queue, if it''s > detecting drag end on your element. Since the code will trigger revert > after that, and will by default push the Effect.Move on this queue, you > should attain your goal. But that''s going out on a limb: > script.aculo.us might very well implement things otherwise in the future. > > -- > Christophe Porteneuve a.k.a. TDD > "[They] did not know it was impossible, so they did it." --Mark Twain > Email: t...-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---