I''ve seen a few posts about this, but no answers. I would like to be able to call a function when a draggable revert occurs. What I''m trying to do is replace a photo with an icon on drag (which I''ve accomplished), but I need to swap it back if the revert fires. I really, really wish there were an onRevert() option, but there isn''t, so I guess I''ll have to hack my own. I think this is where I''d hook it in (line 231 in 1.8.0): reverteffect: function(element, top_offset, left_offset) { var dur Math.sqrt(Math.abs(top_offset^2)+Math.abs(left_offset^2))*0.02; new Effect.Move(element, { x: -left_offset, y: -top_offset, duration: dur, queue: {scope:''_draggable'', position:''end''} }); }, I propose putting it as a beforeStart call in the Effect.Move function. Does this make sense? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
I think having such callback makes sense. Would you mind opening an enhancement ticket? - kangax On Jun 19, 3:20 pm, Diodeus <diod...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''ve seen a few posts about this, but no answers. > > I would like to be able to call a function when a draggable revert > occurs. What I''m trying to do is replace a photo with an icon on drag > (which I''ve accomplished), but I need to swap it back if the revert > fires. > > I really, really wish there were an onRevert() option, but there > isn''t, so I guess I''ll have to hack my own. > > I think this is where I''d hook it in (line 231 in 1.8.0): > > reverteffect: function(element, top_offset, left_offset) { > var dur > Math.sqrt(Math.abs(top_offset^2)+Math.abs(left_offset^2))*0.02; > new Effect.Move(element, { x: -left_offset, y: -top_offset, > duration: dur, > queue: {scope:''_draggable'', position:''end''} > }); > }, > > I propose putting it as a beforeStart call in the Effect.Move > function. > > Does this make sense?--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
I''m posting the enhancement on Lighthouseapp. I hope this is the correct place to do this. On Jun 19, 5:26 pm, kangax <kan...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I think having such callback makes sense. Would you mind opening an > enhancement ticket? > > - kangax > > On Jun 19, 3:20 pm, Diodeus <diod...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > I''ve seen a few posts about this, but no answers. > > > I would like to be able to call a function when a draggable revert > > occurs. What I''m trying to do is replace a photo with an icon on drag > > (which I''ve accomplished), but I need to swap it back if the revert > > fires. > > > I really, really wish there were an onRevert() option, but there > > isn''t, so I guess I''ll have to hack my own. > > > I think this is where I''d hook it in (line 231 in 1.8.0): > > > reverteffect: function(element, top_offset, left_offset) { > > var dur > > Math.sqrt(Math.abs(top_offset^2)+Math.abs(left_offset^2))*0.02; > > new Effect.Move(element, { x: -left_offset, y: -top_offset, > > duration: dur, > > queue: {scope:''_draggable'', position:''end''} > > }); > > }, > > > I propose putting it as a beforeStart call in the Effect.Move > > function. > > > Does this make sense?--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---