Oh, sorry, I missed that you had that method in comments.  That has the same 
effect?

On Feb 28, 2011, at 9:10 AM, Tuukka Mustonen wrote:

> With detach() I got the same effect.
> 
> However, I found out what was causing this. I was having:
> 
> handle.addEvent('mouseup', function(event) {
>    event.stop();  // or event.stopPropagation();
>    drag.stop();
> });
> 
> I called event.stop() to prevent the event from propagating onwards.
> Having it, however, I experienced the issues descibed. Removing the
> event.stop() line fixes the problem - drag is succesfully ended.
> 
> I thought event#stop() would prevent the other callbacks in queue from
> firing, but not touch the coming ones. However, am I actually skipping
> the drag.stop() here calling the event.stop() before it?
> 
> Tuukka
> 
> 
> 
> On 28 helmi, 17:39, Ryan Florence <[email protected]> wrote:
>> Brute force ... but you could maybe try drag.detach()
>> 
>> On Feb 28, 2011, at 8:12 AM, Tuukka Mustonen wrote:
>> 
>>> Thanks for the suggestion, however, I don't believe that would do it.
>>> If I'm intrepreting your example in a correct way, you would stop the
>>> 'drag' only if it has been created (on mousedown). The problem is
>>> exactly this: despite of the drag *object* being created and
>>> programmatically started, calling drag.stop() doesn't really stop the
>>> drag unless it is really really started (different from calling
>>> start()) by moving mouse.
>> 
>>> Does it sound familiar?
>> 
>>> Tuukka
>> 
>>> On 28 helmi, 15:32, "Steve Onnis" <[email protected]> wrote:
>>>> You could add this to the handle of the drag object
>> 
>>>> el.addEvent("mouseup", function () {if(drag) {drag.stop()});
>> 
>>>> -----Original Message-----
>>>> From: Tuukka Mustonen [mailto:[email protected]]
>>>> Sent: Tuesday, 1 March 2011 12:06 AM
>>>> To: MooTools Users
>>>> Subject: [Moo] How to programmatically stop Drag?
>> 
>>>> I create an initialize Drag by:
>> 
>>>> var drag = new Drag.Move(el, {...});
>>>> drag.start(event);
>> 
>>>> If I move mouse after this, the drag gets really initiated (and
>>>> onStart called). At some point I can simply call:
>> 
>>>> drag.stop();
>> 
>>>> And dragging stops as supposed.
>> 
>>>> However, if I start the drag as above, but don't move the mouse before
>>>> calling drag.stop() (for example through a timer), drag.stop() doesn't
>>>> really stop the drag (it gets initiated when I move the mouse).
>> 
>>>> How to kill a start()ed drag before mouse is moved?
>> 
>> 

Reply via email to