mirror of https://github.com/axmolengine/axmol.git
Merge pull request #13303 from pandamicro/v3.7.1
Fix issue described in #13284 by reorder state setting and event dispatching
This commit is contained in:
commit
1f14b5895e
|
@ -360,19 +360,18 @@ void CheckBox::setupFrontCrossDisableTexture()
|
|||
_frontCrossDisabledRendererAdaptDirty = true;
|
||||
}
|
||||
|
||||
|
||||
void CheckBox::releaseUpEvent()
|
||||
void CheckBox::onTouchEnded(Touch *touch, Event *unusedEvent)
|
||||
{
|
||||
Widget::releaseUpEvent();
|
||||
|
||||
if (_isSelected)
|
||||
{
|
||||
setSelected(false);
|
||||
Widget::onTouchEnded(touch, unusedEvent);
|
||||
unSelectedEvent();
|
||||
}
|
||||
else
|
||||
{
|
||||
setSelected(true);
|
||||
Widget::onTouchEnded(touch, unusedEvent);
|
||||
selectedEvent();
|
||||
}
|
||||
}
|
||||
|
@ -391,6 +390,12 @@ void CheckBox::onPressStateChangedToNormal()
|
|||
|
||||
_backGroundBoxRenderer->setScale(_backgroundTextureScaleX, _backgroundTextureScaleY);
|
||||
_frontCrossRenderer->setScale(_backgroundTextureScaleX, _backgroundTextureScaleY);
|
||||
|
||||
if (_isSelected)
|
||||
{
|
||||
_frontCrossRenderer->setVisible(true);
|
||||
_frontCrossRendererAdaptDirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
void CheckBox::onPressStateChangedToPressed()
|
||||
|
@ -433,6 +438,12 @@ void CheckBox::onPressStateChangedToDisabled()
|
|||
_frontCrossRenderer->setVisible(false);
|
||||
_backGroundBoxRenderer->setScale(_backgroundTextureScaleX, _backgroundTextureScaleY);
|
||||
_frontCrossRenderer->setScale(_backgroundTextureScaleX, _backgroundTextureScaleY);
|
||||
|
||||
if (_isSelected)
|
||||
{
|
||||
_frontCrossDisabledRenderer->setVisible(true);
|
||||
_frontCrossDisabledRendererAdaptDirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
void CheckBox::setZoomScale(float scale)
|
||||
|
@ -453,18 +464,6 @@ void CheckBox::setSelected(bool selected)
|
|||
}
|
||||
_isSelected = selected;
|
||||
_frontCrossRenderer->setVisible(_isSelected);
|
||||
|
||||
if (_isSelected)
|
||||
{
|
||||
if (_bright) {
|
||||
_frontCrossRenderer->setVisible(true);
|
||||
_frontCrossRendererAdaptDirty = true;
|
||||
}
|
||||
else {
|
||||
_frontCrossDisabledRenderer->setVisible(true);
|
||||
_frontCrossDisabledRendererAdaptDirty = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool CheckBox::isSelected()const
|
||||
|
|
|
@ -232,6 +232,7 @@ public:
|
|||
|
||||
|
||||
//override functions
|
||||
virtual void onTouchEnded(Touch *touch, Event *unusedEvent) override;
|
||||
virtual Size getVirtualRendererSize() const override;
|
||||
virtual Node* getVirtualRenderer() override;
|
||||
virtual std::string getDescription() const override;
|
||||
|
@ -277,8 +278,6 @@ protected:
|
|||
void selectedEvent();
|
||||
void unSelectedEvent();
|
||||
|
||||
virtual void releaseUpEvent() override;
|
||||
|
||||
virtual void onSizeChanged() override;
|
||||
|
||||
void backGroundTextureScaleChangedWithSize();
|
||||
|
|
Loading…
Reference in New Issue