FlexBox bug (again)


#1

Changed the demo to use a 1px align at the right, at some sizes the margin is 0px / 2px

latest tip, develop

Its due the the same issue with the other previous issue, the coordinates should be always rounded from absolute coordinates (set bottom-right, not width-height)


#2

anyone from the juce team?


#3

I thought we were rounding to absolute positions:


#4

Hmm, that code could be neater

comp->setBounds ({ item.currentBounds.getPosition()   .roundToInt(),
                   item.currentBounds.getBottomRight().roundToInt() });

but it’s functioning the same.


#5

My suspicion is that we’re falling foul of of some rounding error where we’re very close to a .5 boundary - where the centre of the 1px white line is at an integer position.


#6

Just an idea, shoudn‘t the coordinats always rounded down?
Because components are integer based, the responsible pixel between 0.000 and 0.999 is 0 (which fills the whole pixel), and calculated coordinates beginning with 0.000.


#7

If I use roundToIntAccurate rather than roundToInt then the problem is fixed, but that feels a bit brittle; always rounding down seems sensible.


#8

https://github.com/WeAreROLI/JUCE/commit/75236aa61d7a7eaa239bcd80e82809ec55c9a58b


#9

Looks good!