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.


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):


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:


Thanks for the report and fix.