I just spend 4 hours of debugging this, and finally found the problem ![]()
In my layout I use negative margins in a flex box, to overdraw some GUI elements, which is perfectly working in all my plugins.
But after I changed a margin to “-2” the layout fails.
The reasons for this is:
static bool isAuto (Coord value) noexcept { return value == FlexItem::autoValue; }
evaluate in resolveAutoMarginsOnCrossAxis() falsely to true, because a negative margin is interpreted as auto.
static const int autoValue = -2;
A quick fix is to use other “magic” numbers, like the highest possible integer which can be a float, something like “-1000002”, but I guess its better not to rely on magic numbers especially in coordinates which are also stored as float values, which tend to be “floating”.
As I understand the css box model, margins are allowed to be negative. Even if the behaviour in juce is undefined, the result of a calculation of coordinates should maybe result in a “wrong” coordinate, but not how the coordinate is interpreted.
Could, at least in the first step, higher magic numbers can be used, or better add auto (and also notAssigned) attributes to margin?
