Yupie , i guess i fixed that jumping issue when zooming in corners , i just took code from cocos2d-Extensions CCZoomController.
Add this Function
-(void)moveNodeForZoomFromCurPos:(CGPoint)curPos andPrevPos:(CGPoint)prevPos
{
// If scale was changed -> set new scale and fix position with new scale
if (self.node.scale != prevScale)
{
CGPoint realCurPosLayer = [self.node convertToNodeSpace: curPos];
CGFloat deltaX = (realCurPosLayer.x - self.node.anchorPoint.x * self.node.contentSize.width) * (self.node.scale - prevScale);
CGFloat deltaY = (realCurPosLayer.y - self.node.anchorPoint.y * self.node.contentSize.height) * (self.node.scale - prevScale);
CGPoint tempPos = ccp(self.node.position.x - deltaX, self.node.position.y - deltaY);
self.node.position = [self boundPos:tempPos];
}
// If current and previous position of the multitouch's center aren't equal -> change position of the layer
if (!CGPointEqualToPoint(prevPos, curPos))
{
CGPoint tempPos = ccp(self.node.position.x + curPos.x - prevPos.x,
self.node.position.y + curPos.y - prevPos.y);
self.node.position = [self boundPos:tempPos];
}
}
And replace this moveZoom func with this
- (void) moveZoom:(CGPoint)pt otherPt:(CGPoint)pt2
{
//what's the difference in length
float length = ccpDistance(pt, pt2);
float diff = (length-_firstLength);
//ignore small movements
if (fabs(diff) < _pinchDistanceThreshold)
return;
prevScale = _node.scale;
//calculate new scale
float factor = diff * _zoomRate * _pinchDamping;
float newScale = _oldScale + factor;
//bound scale
if (newScale > _zoomInLimit)
newScale = _zoomInLimit;
else if (newScale < _zoomOutLimit)
newScale = _zoomOutLimit;
//set the new scale
_node.scale = newScale;
if(_centerOnPinch == NO)
{
[self updatePosition:_node.position];
}
}
And add this lines after [self moveZoom:pt otherPt:pt2]; in touchesMoved
CGPoint curPosTouch1 = [[CCDirector sharedDirector] convertToGL: [touch1 locationInView: [touch1 view]]];
CGPoint curPosTouch2 = [[CCDirector sharedDirector] convertToGL: [touch2 locationInView: [touch2 view]]];
CGPoint prevPosTouch1 = [[CCDirector sharedDirector] convertToGL: [touch1 previousLocationInView: [touch1 view]]];
CGPoint prevPosTouch2 = [[CCDirector sharedDirector] convertToGL: [touch2 previousLocationInView: [touch2 view]]];
// Calculate current and previous positions of the layer relative the anchor point
CGPoint curPosLayer = ccpMidpoint(curPosTouch1, curPosTouch2);
CGPoint prevPosLayer = ccpMidpoint(prevPosTouch1, prevPosTouch2);
[self moveNodeForZoomFromCurPos:curPosLayer andPrevPos:prevPosLayer];
:)