Merge commit 'refs/pull/4085/head' of git://github.com/cocos2d/cocos2d-x into iss3619

Conflicts:
	extensions/GUI/CCControlExtension/CCControlButton.cpp
This commit is contained in:
James Chen 2014-01-09 11:16:44 +08:00
commit 46009e5daf
2 changed files with 4 additions and 2 deletions

View File

@ -80,13 +80,13 @@ bool ControlButton::initWithLabelAndBackgroundSprite(Node* node, Scale9Sprite* b
_parentInited = true; _parentInited = true;
_isPushed = false; _isPushed = false;
_zoomOnTouchDown = true;
// Adjust the background image by default // Adjust the background image by default
setAdjustBackgroundImage(true); setAdjustBackgroundImage(true);
setPreferredSize(Size::ZERO); setPreferredSize(Size::ZERO);
// Zooming button by default // Zooming button by default
_zoomOnTouchDown = true; _zoomOnTouchDown = true;
_scaleRatio = 1.1f;
// Set the default anchor point // Set the default anchor point
ignoreAnchorPointForPosition(false); ignoreAnchorPointForPosition(false);
@ -199,7 +199,7 @@ void ControlButton::setHighlighted(bool enabled)
needsLayout(); needsLayout();
if( _zoomOnTouchDown ) if( _zoomOnTouchDown )
{ {
float scaleValue = (isHighlighted() && isEnabled() && !isSelected()) ? 1.1f : 1.0f; float scaleValue = (isHighlighted() && isEnabled() && !isSelected()) ? _scaleRatio : 1.0f;
Action *zoomAction = ScaleTo::create(0.05f, scaleValue); Action *zoomAction = ScaleTo::create(0.05f, scaleValue);
zoomAction->setTag(kZoomActionTag); zoomAction->setTag(kZoomActionTag);
runAction(zoomAction); runAction(zoomAction);

View File

@ -226,6 +226,8 @@ protected:
/** Adjust the button zooming on touchdown. Default value is YES. */ /** Adjust the button zooming on touchdown. Default value is YES. */
CC_PROPERTY(bool, _zoomOnTouchDown, ZoomOnTouchDown); CC_PROPERTY(bool, _zoomOnTouchDown, ZoomOnTouchDown);
/** Scale ratio button on touchdown. Default value 1.1f */
CC_SYNTHESIZE(float, _scaleRatio, ScaleRatio);
CC_PROPERTY_PASS_BY_REF(Point, _labelAnchorPoint, LabelAnchorPoint); CC_PROPERTY_PASS_BY_REF(Point, _labelAnchorPoint, LabelAnchorPoint);