[Chicago-talk] Interesting sort question

jason gessner jason at multiply.org
Thu Feb 26 12:56:09 CST 2004


Hi All.

I am having a brain freeze and am turning to you for help.

I have a list that looks like this:

[
	[39, 29.7600], 
	[33, 51.4300], 
	[37, 77.0400], 
	[41, 106.5900], 
	[45, 124.3200], 
	[35, 142.0500], 
	[43, 167.6600]
]

For the sublists, the first point is simply an ID, the 2nd is the center
point Y value for the element.

Each of these elements represents an item on a vertical bar.  

Users can drag elements along the bar, but the labels (the 2nd element in
each array item is the y position for the given element number (1st element)
).

	Items cannot exceed MAX_Y or go below MIN_Y (top and bottom
locations of the bar).
	items need to be separated by MIN_DIST of distance.
	if an item overlaps with another then the item, and the item it
overlaps with need to move a bit, just enough to give them MIN_DIST apart.
Keep in mind that an item can't go above MAX_Y or below MIN_Y.

I can get it to go for the first pass, but it falls down when there are a
lot of them near each other.

Beer at the next meeting for whomever helps unstick my head on this one.

-jason scott gessner
    jason at multiply.org 




More information about the Chicago-talk mailing list