mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-26 02:14:22 +00:00
Fixed a crash when performing layout on an empty Grid using auto flow and added a few Margin convenience constructors
This commit is contained in:
parent
4e69133e54
commit
88c734d28d
3 changed files with 17 additions and 4 deletions
|
|
@ -310,8 +310,9 @@ struct Grid::PlacementHelpers
|
|||
for (const auto& areaString : areasStrings)
|
||||
strings.add (juce::StringArray::fromTokens (areaString, false));
|
||||
|
||||
for (auto s : strings)
|
||||
jassert (s.size() == strings[0].size()); // all rows must have the same number of columns
|
||||
if (strings.size() > 0)
|
||||
for (auto s : strings)
|
||||
jassert (s.size() == strings[0].size()); // all rows must have the same number of columns
|
||||
|
||||
return strings;
|
||||
}
|
||||
|
|
@ -629,8 +630,12 @@ struct Grid::AutoPlacement
|
|||
|
||||
int getHighestCrossDimension() const
|
||||
{
|
||||
return std::max (getCrossDimension ({ occupiedCells.crbegin()->column, occupiedCells.crbegin()->row }),
|
||||
highestCrossDimension);
|
||||
Cell cell { 1, 1 };
|
||||
|
||||
if (occupiedCells.size() > 0)
|
||||
cell = { occupiedCells.crbegin()->column, occupiedCells.crbegin()->row };
|
||||
|
||||
return std::max (getCrossDimension (cell), highestCrossDimension);
|
||||
}
|
||||
|
||||
Cell advance (Cell cell) const
|
||||
|
|
|
|||
|
|
@ -61,9 +61,15 @@ GridItem::Property::Property (Span spanToUse) noexcept
|
|||
GridItem::Margin::Margin() noexcept : left(), right(), top(), bottom()
|
||||
{}
|
||||
|
||||
GridItem::Margin::Margin (int v) noexcept : GridItem::Margin::Margin (static_cast<float> (v))
|
||||
{}
|
||||
|
||||
GridItem::Margin::Margin (float v) noexcept : left (v), right (v), top (v), bottom (v)
|
||||
{}
|
||||
|
||||
GridItem::Margin::Margin (float t, float r, float b, float l) noexcept : left (l), right (r), top (t), bottom (b)
|
||||
{}
|
||||
|
||||
//==============================================================================
|
||||
GridItem::GridItem() noexcept {}
|
||||
GridItem::~GridItem() noexcept {}
|
||||
|
|
|
|||
|
|
@ -160,7 +160,9 @@ public:
|
|||
struct Margin
|
||||
{
|
||||
Margin() noexcept;
|
||||
Margin (int size) noexcept;
|
||||
Margin (float size) noexcept;
|
||||
Margin (float top, float right, float bottom, float left) noexcept; /**< Creates a margin with these sizes. */
|
||||
|
||||
float left;
|
||||
float right;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue