From e92c36593e9afefc66f884d17d5350e384daadb8 Mon Sep 17 00:00:00 2001 From: Knox Date: Wed, 15 Aug 2018 13:51:43 +0800 Subject: [PATCH] fix layout grid bug for fireball/issues/8166 (#3093) --- cocos2d/core/components/CCLayout.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cocos2d/core/components/CCLayout.js b/cocos2d/core/components/CCLayout.js index 0738666906..c54cbec215 100644 --- a/cocos2d/core/components/CCLayout.js +++ b/cocos2d/core/components/CCLayout.js @@ -587,13 +587,13 @@ var Layout = cc.Class({ secondMaxHeight = childBoundingBoxHeight; tempMaxHeight = 0; } - nextX = leftBoundaryOfLayout + sign * (paddingX + anchorX * child.width); + nextX = leftBoundaryOfLayout + sign * (paddingX + anchorX * childBoundingBoxWidth); row++; } } var finalPositionY = fnPositionY(child, rowMaxHeight, row); - if (baseWidth >= (child.width + this.paddingLeft + this.paddingRight)) { + if (baseWidth >= (childBoundingBoxWidth + this.paddingLeft + this.paddingRight)) { if (applyChildren) { child.setPosition(cc.v2(nextX, finalPositionY)); }