mirror of https://github.com/axmolengine/axmol.git
Support negative scaling of CCScrollView.
Not checking for it in CCScrollView::getViewRect causes intersectsRect calls (eg: to check if the touch was within the bounds) to return false.
This commit is contained in:
parent
31a61072a4
commit
4360c3bff8
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue