mirror of https://github.com/axmolengine/axmol.git
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:
commit
46009e5daf
|
@ -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);
|
||||||
|
|
|
@ -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);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue