CCScrollView disaplay area bug:
In function void CCScrollView::beforeDraw(), CCPoint screenPos = this->convertToWorldSpace(this->getParent()->getPosition());
I think it should be: CCPoint screenPos = this->getParent()->convertToWorldSpace(getPosition());
Touch area bug:
In function bool CCScrollView::ccTouchBegan(CCTouch* touch, CCEvent* event) and void CCScrollView::ccTouchMoved(CCTouch* touch, CCEvent* event)
There is something wrong in calculating the frame of scrollview in world space.
CCRect frame; frame = CCRectMake(this->getPosition().x, this->getPosition().y, m_tViewSize.width, m_tViewSize.height);
I think it should be: CCRect frame; CCPoint frameOriginal = this->getParent()->convertToWorldSpace(this->getPosition()); frame = CCRectMake(frameOriginal.x, frameOriginal.y, m_tViewSize.width, m_tViewSize.height);
CCScrollView disaplay area bug:
In function void CCScrollView::beforeDraw(), CCPoint screenPos = this->convertToWorldSpace(this->getParent()->getPosition());
I think it should be: CCPoint screenPos = this->getParent()->convertToWorldSpace(getPosition());
>
Touch area bug:
In function bool CCScrollView::ccTouchBegan(CCTouch* touch, CCEvent* event) and void CCScrollView::ccTouchMoved(CCTouch* touch, CCEvent* event)
There is something wrong in calculating the frame of scrollview in world space.
> CCRect frame; frame = CCRectMake(this->getPosition().x, this->getPosition().y, m_tViewSize.width, m_tViewSize.height);
I think it should be: CCRect frame; CCPoint frameOriginal = this->getParent()->convertToWorldSpace(this->getPosition()); frame = CCRectMake(frameOriginal.x, frameOriginal.y, m_tViewSize.width, m_tViewSize.height);
Is this right? I try it, but there are still some problem
Garfield Kwong wrote:
> I found 2 bugs of CCScrollView.
>
> 1. CCScrollView disaplay area bug:
> In function void CCScrollView::beforeDraw(),
> CCPoint screenPos = this->convertToWorldSpace(this->getParent()->getPosition());
> I think it should be:
> CCPoint screenPos = this->getParent()->convertToWorldSpace(getPosition());
>
> 2. Touch area bug:
> In function bool CCScrollView::ccTouchBegan(CCTouch* touch, CCEvent* event) and void CCScrollView::ccTouchMoved(CCTouch* touch, CCEvent* event)
> There is something wrong in calculating the frame of scrollview in world space.
>
> `CCRect frame;
Garfield Kwong’s Answer is right.
>
And, Add some code in beforeDraw() for retina.
>
CCPoint screenPos = this->getParent()->convertToWorldSpace(getPosition());
screenPos = CC_POINT_POINTS_TO_PIXELS(screenPos); // Add this code for Retina
You’re right, issue #1495 was created for this issue. Thanks.
Garfield Kwong wrote:
I found 2 bugs of CCScrollView.
>
CCScrollView disaplay area bug:
In function void CCScrollView::beforeDraw(), CCPoint screenPos = this->convertToWorldSpace(this->getParent()->getPosition());
I think it should be: CCPoint screenPos = this->getParent()->convertToWorldSpace(getPosition());
>
Touch area bug:
In function bool CCScrollView::ccTouchBegan(CCTouch* touch, CCEvent* event) and void CCScrollView::ccTouchMoved(CCTouch* touch, CCEvent* event)
There is something wrong in calculating the frame of scrollview in world space.
> CCRect frame; frame = CCRectMake(this->getPosition().x, this->getPosition().y, m_tViewSize.width, m_tViewSize.height);
I think it should be: CCRect frame; CCPoint frameOriginal = this->getParent()->convertToWorldSpace(this->getPosition()); frame = CCRectMake(frameOriginal.x, frameOriginal.y, m_tViewSize.width, m_tViewSize.height);