juce::Grid could return wrong layout. / getUnion/getUnionWith Inconsistency

I’ve started to use juce::Grid which is very useful indeed.

Here is an example of wrong behavior under JUCE grid implementation.

CSS:

You can simply copy-paste it into code-pen.
This should result a responsive grid-view that also works well within viewports:

With JUCE and viewport this would break if your last line has 0 height…

ok (if last row height is greater than 0):

bad:

Grid uses juce::Rectangle::getUnion (Rectangle& other) within the getAreaBounds call.
So in case of endCell with 0px height it’ll return only the startCell.

The interesting thing is that juce::Rectangle::getUnion() is different than juce::Range::getUnionWith(). It would be nice if JUCE team could decide what’s the juce approach for those 2 concerns.

Here is our current commit for the meantime:

2 Likes

Thanks for the report and fix.

2 Likes