Open
Description
The issue is inside the CCMoveToY and CCMoveToX that CCScrollView uses.
Here is what the update:
function looks like:
CCMoveToY
-(void) update: (CCTime) t
{
CCNode *node = (CCNode*)_target;
float positionDelta = _endPosition - _startPos;
float y = _startPos + positionDelta * t;
float x = node.position.x;
node.position = ccp(x,y);
block();
}
It should look like this:
-(void) update: (CCTime) t
{
CCNode *node = (CCNode*)_target;
float positionDelta = _endPosition - _startPos;
float y = _startPos + positionDelta * t;
float x = node.position.x;
node.position = ccp(x,y);
if (node.position.y == _endPosition) {
block();
}
}
CCMoveToX
-(void) update: (CCTime) t
{
CCNode *node = (CCNode*)_target;
float positionDelta = _endPosition - _startPos;
float x = _startPos + positionDelta * t;
float y = node.position.y;
node.position = ccp(x,y);
block();
}
What this should look like:
-(void) update: (CCTime) t
{
CCNode *node = (CCNode*)_target;
float positionDelta = _endPosition - _startPos;
float x = _startPos + positionDelta * t;
float y = node.position.y;
node.position = ccp(x,y);
if (node.position.x == _endPosition) {
block();
}
}
I've made the change in my version, should I submit a pull request or you guys can fix this yourself? This should be quite quick.
If you guys wanted a callback to fire every update loop, you might want to name it something along the lines of scrollViewScrolling:
or something. I'm using this to get an idea of when the scroll has finished, I hope I'm not wrong here.
Metadata
Metadata
Assignees
Labels
No labels