Looking into the code a bit more, I believe the fix is the correct
solution for the onEmptyHover function.

As for the reason why there is flickering is because the onEmptyHover
was being toggled for Sortables even though there are items in the
list.  And as an item is moving through a list, the onHover function
of the elements themselves are also toggled.  So in essence 2 events
with different actions are being fired off subsequently nearly every
time the mouse moves in the list.  In a picture the actions look like
this:

 -------------------------------
| onEmptyHover          |
|        ---------------        |
|       | onHover       |       |
|        ---------------        |
|                               |
 -------------------------------

Tobias' solution stops this dual events from happening and works as
the "dropOnEmpty" suggests.  Good work!


On Nov 17, 5:22 am, gwineman <[EMAIL PROTECTED]> wrote:
> Great Fix - I had the same problem - works perfect
>
> On Nov 8, 8:05 am, Tobias Gassmann <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > I applied a quick and dirty hack to the "onEmptyHover"-function to get
> > rid of the flickering when using dropOnEmpty
> > -->  onEmptyHover: function(element, dropon, overlap) {
> > (it's in the dragdrop.js-file)
>
> > There is an if-statement in this function which has to be altered:
>
> > the original line in Version 1.8.1 of scriptaculous reads:
> > -->   " if(!Element.isParent(dropon, element)) {"
>
> > changing this line to
> > -->   " if((!Element.isParent(dropon, element)) &&
> > (Element.empty(dropon))) {"
> > turned the flickering off.
>
> > This can only be used, in case there are no other html-elements in the
> > empty "Drop-On"-Element. Otherwise it remains undroppable.
>
> > The reason for the flickering is (as far as I figured it out) the
> > Element.isParent(dropon,element) returning false, even when the
> > dragged item is still within it's original parent. By checking wether
> > the underlying Droppable is really empty (and therefore not the home-
> > droppable, where the dragged item came from), we can assure that the
> > onEmptyHover-Code is not executed falsely.
>
> > This is only a quick and dirty hack, I did not completely analyze the
> > scriptaculous-code, so it might not work for everyone.
>
> > bye!
> > Tobias
>
> > On Oct 10, 1:15 pm, Sumita <[EMAIL PROTECTED]> wrote:
>
> > > Hi,
> > > I have a horizontal sortable with three images arranged horizontally
> > > in a div (images in a div tag). The moment I introduce
> > > dropOnEmpty:true, and I try to drop an image from another sortable,
> > > there is a flickering and the sortable is creates its own drop
> > > position.
> > > Can you suggest a solution??

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to