Hi, I''m just trying out the possibilities of script.aculo.us / prototype having two problems... I have a draggable element with revert:false-property and two dropzones. (The draggables are in a <td> and the dropzones are <div>s if that is important.) 1. I want the draggable element to snap back to its original position when it gets dropped anywhere out of a dropzone. 2. If the draggable element gets dropped on a dropzone, I want a copy of it on the original position where it as been dragged from and with an opacity. Any ideas ? Thanks Jan
I''m trying to do the same thing as #1 using 1.5 rc3. Basically, if the user drags something somewhere they shouldn''t, i want to run the revert effect. I''ve poked around in dragdrop.js to see if it''s possible without modifying code, but the jury is still out as javascript is not my forte. Does anyone have a suggestion on how to do this? Seems like it would be a pretty common usage scenario. Mike [Rails-spinoffs] Drag & Drop probs *Jan Deppisch* mail at netzartist.de <rails-spinoffs%40lists.rubyonrails.org?Subject=%5BRails-spinoffs%5D%20Drag%20%26%20Drop%20probs&In-Reply-To=> *Tue Oct 11 11:39:36 GMT 2005* - Previous message: SV: [Rails-spinoffs] sriptaculous - Size of files. <http://wrath.rubyonrails.org/pipermail/rails-spinoffs/2005-October/001021.html> - Next message: [Rails-spinoffs] Sortable as a class? <http://wrath.rubyonrails.org/pipermail/rails-spinoffs/2005-October/001023.html> - *Messages sorted by:* [ date ]<http://wrath.rubyonrails.org/pipermail/rails-spinoffs/2005-October/date.html#1022> [ thread ]<http://wrath.rubyonrails.org/pipermail/rails-spinoffs/2005-October/thread.html#1022> [ subject ]<http://wrath.rubyonrails.org/pipermail/rails-spinoffs/2005-October/subject.html#1022> [ author ]<http://wrath.rubyonrails.org/pipermail/rails-spinoffs/2005-October/author.html#1022> ------------------------------ Hi, I''m just trying out the possibilities of script.aculo.us <http://script.aculo.us> / prototype having two problems... I have a draggable element with revert:false-property and two dropzones. (The draggables are in a <td> and the dropzones are <div>s if that is important.) 1. I want the draggable element to snap back to its original position when it gets dropped anywhere out of a dropzone. 2. If the draggable element gets dropped on a dropzone, I want a copy of it on the original position where it as been dragged from and with an opacity. Any ideas ? Thanks Jan _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
Hello Michael, 2005/10/15, Michael Burton <mb-list@niskala.org>:> I'm trying to do the same thing as #1 using 1.5 rc3. Basically, if the user > drags something somewhere they shouldn't, i want to run the revert effect.Have you seen the revert option to Draggable ? Call like this: new Draggable('id', {revert: true}) If your problem is something else, just say so. Bye, François _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
Thank you Francois. I should have clarified a bit. If the user drags something somewhere they shouldn''t, i want to run the revert effect, but I don''t want to run the effect if they drag somewhere valid. Or even better i want to run a different effect if they drag somewhere valid. It''s basically the same behavior as most drag-and-drop systems... if you try to drag an icon in windows or mac os to a target that can''t accept it, it will revert back to its original location. Whereas if you drop it onto a valid folder, it will move to that folder.>From the code it appears that the revert effect will be run whether thedraggable landed on a droppable or not, which is not the desired behavior Mike On 10/16/05, Francois Beausoleil <francois.beausoleil-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Hello Michael, > > 2005/10/15, Michael Burton <mb-list-2MT9zwG8tcBAfugRpC6u6w@public.gmane.org>: > > I''m trying to do the same thing as #1 using 1.5 rc3. Basically, if the > user > > drags something somewhere they shouldn''t, i want to run the revert > effect. > > Have you seen the revert option to Draggable ? Call like this: > new Draggable(''id'', {revert: true}) > > If your problem is something else, just say so. > > Bye, > François > > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > > > >_______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
Hi Michael, did you already find a solution concerning "revert only when not dropped on a dropzone" ? Does anyone else has an idea about my other problem: If the draggable element gets dropped on a dropzone, I want a copy of it on the original position where it as been dragged from and with an opacity. Thx! Am 16.10.2005 um 21:19 Uhr schrieb Michael Burton:> Thank you Francois. I should have clarified a bit. If the user drags > something somewhere they shouldn''t, i want to run the revert effect, but I > don''t want to run the effect if they drag somewhere valid.> Or even better i want to run a different effect if they drag somewhere > valid. It''s basically the same behavior as most drag-and-drop systems... if > you try to drag an icon in windows or mac os to a target that can''t accept > it, it will revert back to its original location. Whereas if you drop it > onto a valid folder, it will move to that folder.>>From the code it appears that the revert effect will be run whether the > draggable landed on a droppable or not, which is not the desired behavior> Mike> On 10/16/05, Francois Beausoleil <francois.beausoleil-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >> Hello Michael, >> >> 2005/10/15, Michael Burton <mb-list-2MT9zwG8tcBAfugRpC6u6w@public.gmane.org>: >> > I''m trying to do the same thing as #1 using 1.5 rc3. Basically, if the >> user >> > drags something somewhere they shouldn''t, i want to run the revert >> effect. >> >> Have you seen the revert option to Draggable ? Call like this: >> new Draggable(''id'', {revert: true}) >> >> If your problem is something else, just say so. >> >> Bye, >> François >> >> _______________________________________________ >> Rails-spinoffs mailing list >> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >> >> >> >>
Hi, what about setting the revert property to false on onDrop event handler? I did this before the ghosted option was created, some months ago and things now are changed a bit. Renato>Hi Michael, > >did you already find a solution concerning "revert only when not >dropped on a dropzone" ? > >Does anyone else has an idea about my other problem: If the draggable >element gets dropped on a dropzone, I want a copy of it on the >original position where it as been dragged from and with an opacity. > >Thx! > >
I believe that the onDrop function is passed the element of the draggable, not the draggable itself, so I don''t actually have access to the revert option. Is there a clever way around this? On 10/19/05, Renato Formato <renatoformato-gH+WsCr1+wQ1GQ1Ptb7lUw@public.gmane.org> wrote:> > Hi, > what about setting the revert property to false on onDrop event handler? > > I did this before the ghosted option was created, some months ago and > things now are changed a bit. > > Renato > > >Hi Michael, > > > >did you already find a solution concerning "revert only when not > >dropped on a dropzone" ? > > > >Does anyone else has an idea about my other problem: If the draggable > >element gets dropped on a dropzone, I want a copy of it on the > >original position where it as been dragged from and with an opacity. > > > >Thx! > > > > > > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >_______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
Have you tried to use the element "drag" property? That should be the Draggable object binded to the element. So you should write something like this: element.drag.options.revert=false; Ciao Renato Michael Burton ha scritto:> I believe that the onDrop function is passed the element of the > draggable, not the draggable itself, so I don''t actually have access > to the revert option. Is there a clever way around this? >
Hi Renato, thanks! The line was exactly what I was searching for. By now I didn''t know how to access a elements'' property. ciao Jan Am 20.10.2005 um 00:28 Uhr schrieb Renato Formato:> Have you tried to use the element "drag" property? That should be the > Draggable object binded to the element. > So you should write something like this: > element.drag.options.revert=false;> Ciao > Renato> Michael Burton ha scritto:>> I believe that the onDrop function is passed the element of the >> draggable, not the draggable itself, so I don''t actually have access >> to the revert option. Is there a clever way around this? >>> _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs