Skip to content

Commit a16d230

Browse files
committed
fix simpleaxislayout not respecting ignoreInvisibleChildren
1 parent 75bf0df commit a16d230

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

loader/src/cocos2d-ext/SimpleAxisLayout.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,12 @@ class SimpleAxisLayout::Impl {
5959
float m_gap = 0.f;
6060
std::optional<float> m_minRelativeScale = 0.5f;
6161
std::optional<float> m_maxRelativeScale = 2.f;
62+
SimpleAxisLayout* m_layout = nullptr;
6263

6364
std::unordered_map<CCNode*, float> m_originalScalesPerNode;
6465
std::unordered_map<CCNode*, float> m_relativeScalesPerNode;
6566

66-
Impl(Axis axis) : m_axis(axis) {
67+
Impl(Axis axis, SimpleAxisLayout* parent) : m_axis(axis), m_layout(parent) {
6768
switch (axis) {
6869
case Axis::Column:
6970
m_mainAxisDirection = AxisDirection::TopToBottom;
@@ -682,7 +683,7 @@ void SimpleAxisLayout::Impl::apply(cocos2d::CCNode* layout) {
682683
std::vector<AxisGap*> gaps;
683684
float totalGap = 0.f;
684685
CCNode* lastChild = nullptr;
685-
for (auto child : CCArrayExt<CCNode*>(layout->getChildren())) {
686+
for (auto child : CCArrayExt<CCNode*>(m_layout->getNodesToPosition(layout))) {
686687
if (auto spacer = typeinfo_cast<SpacerNode*>(child)) {
687688
spacers.push_back(spacer);
688689
positionChildren.push_back(spacer);
@@ -760,7 +761,7 @@ void SimpleAxisLayout::Impl::apply(cocos2d::CCNode* layout) {
760761
this->applyMainPositioning(layout, positionChildren, spacers, totalGap);
761762
}
762763

763-
SimpleAxisLayout::SimpleAxisLayout(Axis axis) : m_impl(std::make_unique<Impl>(axis)) {}
764+
SimpleAxisLayout::SimpleAxisLayout(Axis axis) : m_impl(std::make_unique<Impl>(axis, this)) {}
764765

765766
SimpleAxisLayout::~SimpleAxisLayout() = default;
766767

0 commit comments

Comments
 (0)