From 61a87e7e8b173a5b9d46288e4373809ea0387381 Mon Sep 17 00:00:00 2001 From: Ningyu Date: Wed, 30 Jul 2014 14:00:01 +0800 Subject: [PATCH 1/3] fix LabelTTF::getBoundingBox() position error --- cocos/2d/CCLabelTTF.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cocos/2d/CCLabelTTF.cpp b/cocos/2d/CCLabelTTF.cpp index 63acc40e11..e59caa4285 100644 --- a/cocos/2d/CCLabelTTF.cpp +++ b/cocos/2d/CCLabelTTF.cpp @@ -280,7 +280,9 @@ const Size& LabelTTF::getContentSize() const Rect LabelTTF::getBoundingBox() const { - return _renderLabel->getBoundingBox(); + Size size = getContentSize(); + Rect rect = Node::getBoundingBox(); + return rect; } #if defined(__GNUC__) && ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1))) From 52ca596b3d3fc12599233efe52b26c2af65a5644 Mon Sep 17 00:00:00 2001 From: Ningyu Date: Wed, 30 Jul 2014 16:19:05 +0800 Subject: [PATCH 2/3] code tidy --- cocos/2d/CCLabelTTF.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cocos/2d/CCLabelTTF.cpp b/cocos/2d/CCLabelTTF.cpp index e59caa4285..c7e85ebd38 100644 --- a/cocos/2d/CCLabelTTF.cpp +++ b/cocos/2d/CCLabelTTF.cpp @@ -280,9 +280,8 @@ const Size& LabelTTF::getContentSize() const Rect LabelTTF::getBoundingBox() const { - Size size = getContentSize(); - Rect rect = Node::getBoundingBox(); - return rect; + const_cast(this)->setContentSize(_renderLabel->getContentSize()); + return Node::getBoundingBox(); } #if defined(__GNUC__) && ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1))) From d53cdc39df2a834b3ca28a9760e167a4be78cda2 Mon Sep 17 00:00:00 2001 From: Ningyu Date: Wed, 30 Jul 2014 16:20:58 +0800 Subject: [PATCH 3/3] tab to spaces --- cocos/2d/CCLabelTTF.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cocos/2d/CCLabelTTF.cpp b/cocos/2d/CCLabelTTF.cpp index c7e85ebd38..e55a957768 100644 --- a/cocos/2d/CCLabelTTF.cpp +++ b/cocos/2d/CCLabelTTF.cpp @@ -280,8 +280,8 @@ const Size& LabelTTF::getContentSize() const Rect LabelTTF::getBoundingBox() const { - const_cast(this)->setContentSize(_renderLabel->getContentSize()); - return Node::getBoundingBox(); + const_cast(this)->setContentSize(_renderLabel->getContentSize()); + return Node::getBoundingBox(); } #if defined(__GNUC__) && ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1)))