From 3da695b184077c580898f17e19e75b7959e90f40 Mon Sep 17 00:00:00 2001 From: Dhilan007 Date: Fri, 28 Mar 2014 11:03:39 +0800 Subject: [PATCH] fixed got wrong Rect by Label::getBoundingBox. --- cocos/2d/CCLabel.cpp | 7 +++++++ cocos/2d/CCLabel.h | 2 ++ 2 files changed, 9 insertions(+) diff --git a/cocos/2d/CCLabel.cpp b/cocos/2d/CCLabel.cpp index da596b71e2..27ce8d3517 100644 --- a/cocos/2d/CCLabel.cpp +++ b/cocos/2d/CCLabel.cpp @@ -1364,6 +1364,13 @@ const Size& Label::getContentSize() const return Node::getContentSize(); } +Rect Label::getBoundingBox() const +{ + const_cast(this)->getContentSize(); + + return Node::getBoundingBox(); +} + void Label::listenToBackground(EventCustom *event) { #if CC_ENABLE_CACHE_TEXTURE_DATA diff --git a/cocos/2d/CCLabel.h b/cocos/2d/CCLabel.h index 01f133cfe0..d319b607e6 100644 --- a/cocos/2d/CCLabel.h +++ b/cocos/2d/CCLabel.h @@ -243,6 +243,8 @@ public: virtual const Size& getContentSize() const override; + virtual Rect getBoundingBox() const; + FontAtlas* getFontAtlas() { return _fontAtlas; } /** Listen "come to background" message It only has effect on Android.