Merge pull request #2495 from ptekchand/master

fixed #2116: Support negative node scales of CCScrollView.
This commit is contained in:
James Chen 2013-05-06 23:06:54 -07:00
commit eaad4f52af
1 changed files with 13 additions and 1 deletions

View File

@ -764,7 +764,19 @@ CCRect CCScrollView::getViewRect()
scaleX *= p->getScaleX();
scaleY *= p->getScaleY();
}
// Support negative scaling. Not doing so causes intersectsRect calls
// (eg: to check if the touch was within the bounds) to return false.
// Note, CCNode::getScale will assert if X and Y scales are different.
if(scaleX<0.f) {
screenPos.x += m_tViewSize.width*scaleX;
scaleX = -scaleX;
}
if(scaleY<0.f) {
screenPos.y += m_tViewSize.height*scaleY;
scaleY = -scaleY;
}
return CCRectMake(screenPos.x, screenPos.y, m_tViewSize.width*scaleX, m_tViewSize.height*scaleY);
}