bool CCScrollView::initWithViewSize(CCSize size, CCNode *container/* = NULL*/) { if (CCLayer::init()) { m_pContainer = container; if (!this->m_pContainer) { m_pContainer = CCLayer::create(); this->m_pContainer->ignoreAnchorPointForPosition(false); this->m_pContainer->setAnchorPoint(ccp(0.0f, 0.0f)); } this->setViewSize(size); setTouchEnabled(true); setTouchSwallowEnabled(false); m_pTouches = new CCArray(); m_pDelegate = NULL; m_bBounceable = true; m_bClippingToBounds = true; //m_pContainer->setContentSize(CCSizeZero); m_eDirection = kCCScrollViewDirectionBoth; m_pContainer->setPosition(ccp(0.0f, 0.0f)); m_fTouchLength = 0.0f; this->addChild(m_pContainer); m_fMinScale = m_fMaxScale = 1.0f; m_mapScriptHandler.clear(); return true; } return false; }
static int tolua_Cocos2d_Node_setTouchSwallowEnabled(lua_State* tolua_S) { #if COCOS2D_DEBUG >= 1 tolua_Error tolua_err; if ( !tolua_isusertype(tolua_S,1,"cc.Node",0,&tolua_err) || !tolua_isboolean(tolua_S,2,0,&tolua_err) || !tolua_isnoobj(tolua_S,3,&tolua_err) ) goto tolua_lerror; else #endif { Node* self = static_cast<cocos2d::Node*>(tolua_tousertype(tolua_S,1,0)); bool value = ((bool) tolua_toboolean(tolua_S,2,0)); #if COCOS2D_DEBUG >= 1 if (!self) tolua_error(tolua_S,"invalid 'self' in function 'setTouchSwallowEnabled'", nullptr); #endif { auto mng = LuaNodeManager::getInstance(); auto lnode = mng->getLuaNodeByNode(self, true); if (!lnode) { return 0; } lnode->setTouchSwallowEnabled(value); } } return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: tolua_error(tolua_S,"#ferror in function 'setTouchSwallowEnabled'.",&tolua_err); return 0; #endif }