From 187e360201bcf1d83d5c8dd8404d46b3a9e05b29 Mon Sep 17 00:00:00 2001 From: HJfod <60038575+HJfod@users.noreply.github.com> Date: Sat, 11 Feb 2023 19:30:55 +0200 Subject: [PATCH] fix layout crash if some node is too large to fit in any row --- loader/src/cocos2d-ext/Layout.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/loader/src/cocos2d-ext/Layout.cpp b/loader/src/cocos2d-ext/Layout.cpp index 01470232..0387e939 100644 --- a/loader/src/cocos2d-ext/Layout.cpp +++ b/loader/src/cocos2d-ext/Layout.cpp @@ -93,7 +93,9 @@ AxisLayout::Row* AxisLayout::fitInRow(CCNode* on, CCArray* nodes, float scale, f nextAxisLength += pos.axisLength; // if multiple rows are allowed and this row is full, time for the // next row - if (m_growCrossAxis && nextAxisLength > available.axisLength) { + // also force at least one object to be added to this row, because if + // it's too large for this row it's gonna be too large for all rows + if (m_growCrossAxis && nextAxisLength > available.axisLength && ix != 0) { break; } res->addObject(node);