I think i’ve found a bug when the currentSize is lower than minSize, and minSize = maxSize. If this happens, the final result can generate numbers that are under the minSize value.
This code fails:
[code] StretchableObjectResizer sor;
Array comps;
comps.add(50); // Max 200
comps.add(1); // Max 6
comps.add(50); // Max 200
comps.add(1); // Max 6
comps.add(50); // Max 200
for (uint8 i=0; i<comps.size(); ++i)
{
const int32 fixMax = ((i == 1) || (i == 3))? 6 : 200;
const int32 fixMin = 6;
const int32 size = comps.getUnchecked(i);
sor.addItem(size, fixMin, fixMax, 0);
}
sor.resizeToFit(200);
for (uint8 i=0; i<comps.size(); ++i)
{
const int32 height = roundDoubleToInt(sor.getItemSize(i));
DBG(String(height))
}
[/code]
It generates:
66
2
66
2
66
Is it a bug? I think it’s
