From a5f3fe10c746815a75344e12e4ed81a5e1c050d1 Mon Sep 17 00:00:00 2001
From: HJfod <60038575+HJfod@users.noreply.github.com>
Date: Sat, 15 Apr 2023 15:08:28 +0300
Subject: [PATCH] fix layouts not working properly on nodes whose scale isn't 1

---
 loader/src/cocos2d-ext/Layout.cpp | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/loader/src/cocos2d-ext/Layout.cpp b/loader/src/cocos2d-ext/Layout.cpp
index 7ce5c3f6..e1015579 100644
--- a/loader/src/cocos2d-ext/Layout.cpp
+++ b/loader/src/cocos2d-ext/Layout.cpp
@@ -304,7 +304,7 @@ AxisLayout::Row* AxisLayout::fitInRow(
     float crossLength;
     auto res = CCArray::create();
 
-    auto available = nodeAxis(on, m_axis, 1.f);
+    auto available = nodeAxis(on, m_axis, 1.f / on->getScale());
 
     auto fit = [&](CCArray* nodes) {
         nextAxisScalableLength = 0.f;
@@ -529,8 +529,7 @@ void AxisLayout::tryFitLayout(
         return;
     }
 
-    auto available = nodeAxis(on, m_axis, 1.f);
-
+    auto available = nodeAxis(on, m_axis, 1.f / on->getScale());
     if (available.axisLength <= 0.f) {
         return;
     }