diff --git a/cocos/ui/UIButton.cpp b/cocos/ui/UIButton.cpp index 4b781ddca7..dbb8fdc768 100644 --- a/cocos/ui/UIButton.cpp +++ b/cocos/ui/UIButton.cpp @@ -24,11 +24,11 @@ THE SOFTWARE. #include "ui/UIButton.h" #include "ui/UIScale9Sprite.h" -#include "ui/UIHelper.h" #include "2d/CCLabel.h" #include "2d/CCSprite.h" #include "2d/CCActionInterval.h" #include "platform/CCFileUtils.h" +#include "ui/UIHelper.h" NS_CC_BEGIN @@ -842,7 +842,6 @@ Size Button::getNormalSize() const { titleSize = _titleRenderer->getContentSize(); } - Size imageSize; if (_buttonNormalRenderer != nullptr) { @@ -854,6 +853,10 @@ Size Button::getNormalSize() const return Size(width,height); } +Size Button::getNormalTextureSize() const +{ + return _normalTextureSize; +} } NS_CC_END diff --git a/cocos/ui/UIButton.h b/cocos/ui/UIButton.h index 10c9ef0a79..f4eef3ce32 100644 --- a/cocos/ui/UIButton.h +++ b/cocos/ui/UIButton.h @@ -212,6 +212,7 @@ CC_CONSTRUCTOR_ACCESS: const std::string& disableImage = "", TextureResType texType = TextureResType::LOCAL); + virtual Size getNormalTextureSize() const; protected: virtual void initRenderer() override;