Every time i drag the ResizerBar, it jumps immediately ca. 100 pixels to the left. The more left the resizer bar is, the more will it jump. When its reached its maximum left position, i need to drag the mouse ca. 150 to the right side, bevore something is changed.
it took me 3 hours to understand how the algorithm works, this should fix the bug
[code]int StretchableLayoutManager::fitComponentsIntoSpace (const int startIndex,
const int endIndex,
const int availableSpace,
int startPos)
{
// calculate the total sizes
int i;
double totalIdealSize = 0.0;
int totalMinimums = 0;
for (i = startIndex; i < endIndex; ++i)
{
ItemLayoutProperties* const layout = items.getUnchecked (i);
layout->currentSize = sizeToRealSize (layout->minSize, totalSize);
totalMinimums += layout->currentSize;
//delete totalIdealSize += sizeToRealSize (layout->preferredSize, availableSpace);
/*add*/ totalIdealSize += sizeToRealSize (layout->preferredSize, totalSize);
}
if (totalIdealSize <= 0)
totalIdealSize = 1.0;
// now calc the best sizes..
int extraSpace = availableSpace - totalMinimums;
while (extraSpace > 0)
{
int numWantingMoreSpace = 0;
int numHavingTakenExtraSpace = 0;
// first figure out how many comps want a slice of the extra space..
for (i = startIndex; i < endIndex; ++i)
{
ItemLayoutProperties* const layout = items.getUnchecked (i);
(That class was an absolute bastard to write, I must admit…)
I actually can’t remember or understand enough of how it works to really be confident that your suggestion’s correct, but I’ll try it out and see if it seems to break anything!