Lazy Draggable creation will speed your page load time, but not drag  
time.  As I said, laggy dragging is likely due to the number of  
droppables being checked every mouse move.

I've been told JQuery gets around the problem by caching the position  
of all droppables at the start of the drag, so the pos isn't  
calculated each iteration.  This is a bit troublesome in S.a.us,  
because the default Sortable behavior moves droppables around.  I've  
been meaning to attempt a position caching scheme, but haven't had time.

Another optimization that might be useful in S.a.us (a very brief  
code check suggests this hasn't been implemented), is to begin  
checking each droppable beginning with the droppable the draggable  
was last over.  This could be extended (and I know this hasn't been  
implemented in S.a.us) to "spiral" out, by checking droppables  
closest in the DOM tree to the most recent Droppable.  These might be  
easier to implement than caching.

Peter's solution is complicated, and doesn't work well for draggables  
of an arbitrary size or with text in the click area. (He may  
disagree.) You can simplify by utilizing the native mouse event  
triggered droppables  (mouseenter, etc.) if you move your draggable  
out from under your cursor, but this can be a bit jarring to the user.

Yes, it's something that needs to be addressed in the library.


TAG

On Feb 26, 2007, at 10:04 AM, Jean-Philippe Encausse wrote:

>
> Well,
>
> I have implemented the lazy Draggable onmousedown, but it is not  
> faster.
>
> It seems that:
>
> - Calling Droppables.add(li,{greedy:false, onHover:Ajax.Tree._onHover,
> onDrop:Ajax.Tree._onDrop});
>
> - Dragging is slow
>
> Is very slow ...
>
> Any Idea to did that with scriptaculous ?
> http://peter.michaux.ca/article/15 seems complicated .... ?
>
>
>
> On 2/23/07, Jean-Philippe Encausse <[EMAIL PROTECTED]> wrote:
>> Many thanks, that's really interesting !
>>
>> I gonna try the "mouse down" solution for Draggables that slow page
>> initialization then I will try to find a solution for Droppables.
>>
>> Jp
>>
>>
>> On 2/22/07, Tom Gregory <[EMAIL PROTECTED]> wrote:
>>>
>>> Your real slowdown is probably from the number of Droppables which
>>> must be checked on each mousemove. Various solutions (Peter will
>>> point out he "doughnut" concept) have been proposed, but none are
>>> part of the scriptaculous core.
>>>
>>> So far as lazily creating Draggables:  some on this list create them
>>> on mouseover, which works nicely.  In the past I've even waited  
>>> until
>>> the mousedown, but that requires an extra bit of coding to
>>> immediately kick-start the draggable:
>>>
>>> onMouseDown: function (event) {
>>>      var d = new Draggable('someDivId');
>>>
>>>      //You'll need to add these two lines to start a draggable if
>>> mouse is already down
>>>      d.initDrag(event);
>>>      Draggables.updateDrag(event);
>>> }
>>>
>>>
>>> TAG
>>>
>>> On Feb 22, 2007, at 9:54 AM, Jean-Philippe Encausse wrote:
>>>
>>>>
>>>> Thanks,
>>>>
>>>> For this problem I solved it by setting a specific anchor to drag
>>>> (without links).
>>>> But Setting 300 anchors is slow...
>>>>
>>>> May be If I set the anchor Draggable only onMouseDown it would  
>>>> works ?
>>>> It would be a lazy solution ?
>>>>
>>>
>>>
>>>>>
>>>
>>
>>
>> --
>> Jean-Philippe Encausse - R&D Jalios SA
>> Jp [at] encausse.net - http://www.encausse.com - http:// 
>> www.jalias.com
>> GTalk: jp.encausse [at] gmail.com - SMS: sms [at] jp.encausse.net
>> Mob: +33 6 82 12 56 99 Jalios: +33 1 39 23 92 83 Tel: +33 1 39 18  
>> 90 15
>> Do it Once, Use it Twice ~ Do it Twice, Make It Once
>>
>
>
> -- 
> Jean-Philippe Encausse - R&D Jalios SA
> Jp [at] encausse.net - http://www.encausse.com - http://www.jalias.com
> GTalk: jp.encausse [at] gmail.com - SMS: sms [at] jp.encausse.net
> Mob: +33 6 82 12 56 99 Jalios: +33 1 39 23 92 83 Tel: +33 1 39 18  
> 90 15
> Do it Once, Use it Twice ~ Do it Twice, Make It Once
>
> >


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to