mirror of
https://github.com/geode-sdk/geode.git
synced 2025-03-22 02:45:49 -04:00
add cross axis line alignment to layouts
This commit is contained in:
parent
b6c1c8b66e
commit
295aedbdb5
2 changed files with 21 additions and 5 deletions
loader
15
loader/include/Geode/cocos/base_nodes/Layout.hpp
vendored
15
loader/include/Geode/cocos/base_nodes/Layout.hpp
vendored
|
@ -204,6 +204,7 @@ protected:
|
|||
Axis m_axis;
|
||||
AxisAlignment m_axisAlignment = AxisAlignment::Center;
|
||||
AxisAlignment m_crossAlignment = AxisAlignment::Center;
|
||||
AxisAlignment m_crossLineAlignment = AxisAlignment::Center;
|
||||
float m_gap = 5.f;
|
||||
bool m_autoScale = true;
|
||||
bool m_axisReverse = false;
|
||||
|
@ -256,6 +257,7 @@ public:
|
|||
Axis getAxis() const;
|
||||
AxisAlignment getAxisAlignment() const;
|
||||
AxisAlignment getCrossAxisAlignment() const;
|
||||
AxisAlignment getCrossAxisLineAlignment() const;
|
||||
float getGap() const;
|
||||
bool getAxisReverse() const;
|
||||
bool getCrossAxisReverse() const;
|
||||
|
@ -265,15 +267,20 @@ public:
|
|||
|
||||
AxisLayout* setAxis(Axis axis);
|
||||
/**
|
||||
* Sets where to align the target node's children on the main axis (X for
|
||||
* Row, Y for Column)
|
||||
* Sets where to align the target node's children on the main axis (X-axis
|
||||
* for Row, Y-axis for Column)
|
||||
*/
|
||||
AxisLayout* setAxisAlignment(AxisAlignment align);
|
||||
/**
|
||||
* Sets where to align the target node's children on the cross-axis (Y for
|
||||
* Row, X for Column)
|
||||
* Sets where to align the target node's children on the cross-axis (Y-axis
|
||||
* for Row, X-axis for Column)
|
||||
*/
|
||||
AxisLayout* setCrossAxisAlignment(AxisAlignment align);
|
||||
/**
|
||||
* Sets where to align the target node's children on the cross-axis for
|
||||
* each row (Y-axis for Row, X-axis for Column)
|
||||
*/
|
||||
AxisLayout* setCrossAxisLineAlignment(AxisAlignment align);
|
||||
/**
|
||||
* The spacing between the children of the node this layout applies to.
|
||||
* Measured as the space between their edges, not centres. Does not apply
|
||||
|
|
|
@ -636,7 +636,7 @@ void AxisLayout::tryFitLayout(
|
|||
row->axisEndsLength * row->scale * (1.f - row->squish) * 1.f / nodes->count();
|
||||
}
|
||||
float crossOffset;
|
||||
switch (m_crossAlignment) {
|
||||
switch (m_crossLineAlignment) {
|
||||
case AxisAlignment::Start: {
|
||||
crossOffset = pos.crossLength * pos.crossAnchor;
|
||||
} break;
|
||||
|
@ -725,6 +725,10 @@ AxisAlignment AxisLayout::getCrossAxisAlignment() const {
|
|||
return m_crossAlignment;
|
||||
}
|
||||
|
||||
AxisAlignment AxisLayout::getCrossAxisLineAlignment() const {
|
||||
return m_crossLineAlignment;
|
||||
}
|
||||
|
||||
AxisAlignment AxisLayout::getAxisAlignment() const {
|
||||
return m_axisAlignment;
|
||||
}
|
||||
|
@ -763,6 +767,11 @@ AxisLayout* AxisLayout::setCrossAxisAlignment(AxisAlignment align) {
|
|||
return this;
|
||||
}
|
||||
|
||||
AxisLayout* AxisLayout::setCrossAxisLineAlignment(AxisAlignment align) {
|
||||
m_crossLineAlignment = align;
|
||||
return this;
|
||||
}
|
||||
|
||||
AxisLayout* AxisLayout::setAxisAlignment(AxisAlignment align) {
|
||||
m_axisAlignment = align;
|
||||
return this;
|
||||
|
|
Loading…
Reference in a new issue