mirror of https://github.com/axmolengine/axmol.git
Fix widget onEnter override in JS may cause infinite recursion
This commit is contained in:
parent
3a58668d71
commit
0a31199a5b
|
@ -223,6 +223,14 @@ bool Widget::init()
|
||||||
|
|
||||||
void Widget::onEnter()
|
void Widget::onEnter()
|
||||||
{
|
{
|
||||||
|
#if CC_ENABLE_SCRIPT_BINDING
|
||||||
|
if (_scriptType == kScriptTypeJavascript)
|
||||||
|
{
|
||||||
|
if (ScriptEngineManager::sendNodeEventToJSExtended(this, kNodeOnEnter))
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!_usingLayoutComponent)
|
if (!_usingLayoutComponent)
|
||||||
updateSizeAndPosition();
|
updateSizeAndPosition();
|
||||||
ProtectedNode::onEnter();
|
ProtectedNode::onEnter();
|
||||||
|
@ -230,6 +238,14 @@ void Widget::onEnter()
|
||||||
|
|
||||||
void Widget::onExit()
|
void Widget::onExit()
|
||||||
{
|
{
|
||||||
|
#if CC_ENABLE_SCRIPT_BINDING
|
||||||
|
if (_scriptType == kScriptTypeJavascript)
|
||||||
|
{
|
||||||
|
if (ScriptEngineManager::sendNodeEventToJS(this, kNodeOnExit))
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
unscheduleUpdate();
|
unscheduleUpdate();
|
||||||
ProtectedNode::onExit();
|
ProtectedNode::onExit();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue