It seems that juce::Grid::alignItems
and juce::Grid::justifyItems
have no effect.
The expected behaviour, as shown in this fiddle is that when alignItems
is set to start
, the height of the items is set to their minimum and they’re aligned at the top of their cell. Same with justifyItems
only horizontally:
However applying the same properties to juce::Grid
doesn’t produce an equivalent result:
Full MainComponent.h
to reproduce:
#pragma once
#include <juce_gui_extra/juce_gui_extra.h>
class MainComponent : public juce::Component {
public:
MainComponent()
{
addAndMakeVisible(button1);
addAndMakeVisible(button2);
addAndMakeVisible(button3);
addAndMakeVisible(button4);
setSize (600, 400);
}
void resized() final
{
juce::Grid grid;
grid.templateColumns = {
juce::Grid::Px{200},
juce::Grid::Px{200},
};
grid.templateRows = {
juce::Grid::Px{100},
juce::Grid::Fr{1},
};
grid.alignItems = juce::Grid::AlignItems::start;
grid.justifyItems = juce::Grid::JustifyItems::start;
grid.items = {
juce::GridItem{button1},
juce::GridItem{button2},
juce::GridItem{button3},
juce::GridItem{button4},
};
grid.performLayout(getLocalBounds());
}
private:
juce::TextButton button1{"1"};
juce::TextButton button2{"2"};
juce::TextButton button3{"3"};
juce::TextButton button4{"4"};
};
juce::GridItem::alignSelf
and juce::GridItem::justifySelf
also appear to have no effect.