cocos2dx 3.2 ScrollView 2个bug(滚动方向相反和jump函数不能用
发布时间:2020-12-14 21:20:06 所属栏目:百科 来源:网络整理
导读:ScrollView 1 CC_SYNTHESIZE(bool,_bOpposite,BOpposite); //jnbool m_bIsChangeInnerContainerPos; // jn 2 _bOpposite = false; //jnm_bIsChangeInnerContainerPos = false; //jn 3 void ScrollView::onSizeChanged(){ //... if(!m_bIsChangeInnerContaine
ScrollView <1> CC_SYNTHESIZE(bool,_bOpposite,BOpposite); //jn bool m_bIsChangeInnerContainerPos; // jn <2>
_bOpposite = false; //jn m_bIsChangeInnerContainerPos = false; //jn<3> void ScrollView::onSizeChanged() { //... if(!m_bIsChangeInnerContainerPos){ //jn 判断是不是改过位置 改过的话就不要再onsize里面初始化位置 2015-5-18 _innerContainer->setPosition(Vec2(0,_contentSize.height - _innerContainer->getContentSize().height)); } }<4> void ScrollView::jumpToDestination(const Vec2 &des) { if(!_innerContainer->getPosition().equals(Vec2::ZERO)){ //jn新增 5-18 m_bIsChangeInnerContainerPos = true; } //... }<5> void ScrollView::handleMoveLogic(Touch *touch) { Vec2 delta = -touch->getLocation() + touch->getPreviousLocation(); switch (_direction) { case Direction::VERTICAL: // vertical { if(_bOpposite){ scrollChildren(0.0f,-delta.y); //jn 原来是:scrollChildren(0.0f,delta.y); 改动scrollview滚动方向,原来相反了。贾楠修改。 }else{ scrollChildren(0.0f,delta.y); //jn 原来是:scrollChildren(0.0f,原来相反了。贾楠修改。 } break; } case Direction::HORIZONTAL: // horizontal { scrollChildren(delta.x,0.0f); break; } case Direction::BOTH: // both { scrollChildren(delta.x,delta.y); break; } default: break; } } ListView <1>
public class AppActivity extends Cocos2dxActivity { //... public Cocos2dxGLSurfaceView onCreateView(){ Cocos2dxGLSurfaceView glSurfaceView = new Cocos2dxGLSurfaceView(this); glSurfaceView.setEGLConfigChooser(5,6,5,16,8); return glSurfaceView; } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |