From 2bb26e31d0626c6aee4d84adcbb30e4245abd13c Mon Sep 17 00:00:00 2001 From: Mazyad Alabduljaleel Date: Fri, 17 Jul 2015 17:38:16 +0300 Subject: [PATCH] simplify CGRect math --- cocos/ui/UIEditBox/UIEditBoxImpl-ios.mm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cocos/ui/UIEditBox/UIEditBoxImpl-ios.mm b/cocos/ui/UIEditBox/UIEditBoxImpl-ios.mm index a0e0c113bbc2..0e9612aa58dd 100644 --- a/cocos/ui/UIEditBox/UIEditBoxImpl-ios.mm +++ b/cocos/ui/UIEditBox/UIEditBoxImpl-ios.mm @@ -54,8 +54,7 @@ - (CGRect)textRectForBounds:(CGRect)bounds auto glview = cocos2d::Director::getInstance()->getOpenGLView(); float padding = CC_EDIT_BOX_PADDING * glview->getScaleX() / glview->getContentScaleFactor(); - return CGRectMake(bounds.origin.x + padding, bounds.origin.y + padding, - bounds.size.width - padding*2, bounds.size.height - padding*2); + return CGRectInset(bounds, padding, padding); } - (CGRect)editingRectForBounds:(CGRect)bounds