I played a bit more with it and Gareth, you're right. The extra pixels
come from any margins between the Sortables. If you remove any
distances between them, all works good, with or without the (child ==
null) patch. I wish this info was somewhere in the documentation: When
creating many small size Sortables in a Droppable row or column, make
sure there isn't any margins between them, or the last few may jump
around when trying to arrange them.
So the "- (children.length * 2)" worked for me because there were 2px
margins between them, but the proper way is to stack them without any
distance and then use another element inside to make them "look nice".
On Jun 20, 7:03 pm, azaozz <[EMAIL PROTECTED]> wrote:
> Gareth, I'm still unclear where this error in calculating the offset
> comes from. In theory, the code is fine. It just calculates where
> you're dropping. In practice when using small size Droppables, there
> is an error of about 2px per Droppable, so by adding "-
> (children.length * 2)", this error is corrected ("children.length" is
> the number of children already in the container).
>
> On Jun 20, 6:16 pm, "Gareth Evans" <[EMAIL PROTECTED]> wrote:
>
> > How interesting.
> > I must have read that code a dozen times or more, trying to understand how
> > it works...
>
> > Why does the *2 work?
> > And why does subtracting double the children work- maybe its something to do
> > with padding?
>
> > Gareth
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---