mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-23 07:57:51 -05:00
i didnt test it if that helps
This commit is contained in:
parent
30c9a8ec82
commit
5c8ee29cd3
1 changed files with 11 additions and 9 deletions
|
@ -26,16 +26,18 @@ void GenericContentLayer::setPosition(CCPoint const& pos) {
|
|||
|
||||
void ScrollLayer::visit() {
|
||||
if (m_cutContent && this->isVisible()) {
|
||||
auto rect = CCRect(this->getPosition(), this->getScaledContentSize());
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
|
||||
if (this->getParent()) {
|
||||
// rob messed this up somehow causing nested ScrollLayers to be not clipped properly
|
||||
// this: this->getParent()->convertToWorldSpace(this->getParent()->getPosition() + rect.origin);
|
||||
rect.origin = this->getParent()->convertToWorldSpace(rect.origin);
|
||||
}
|
||||
CCPoint const offset = this->isIgnoreAnchorPointForPosition()
|
||||
? ccp(0, 0) : this->getContentSize() * -this->getAnchorPoint();
|
||||
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
CCEGLView::get()->setScissorInPoints(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height);
|
||||
auto const bottomLeft = this->convertToWorldSpace(ccp(0, 0) - offset);
|
||||
auto const topRight = this->convertToWorldSpace(this->getContentSize() - offset);
|
||||
CCSize const size = topRight - bottomLeft;
|
||||
|
||||
CCEGLView::get()->setScissorInPoints(bottomLeft.x, bottomLeft.y, size.width, size.height);
|
||||
}
|
||||
}
|
||||
|
||||
CCNode::visit();
|
||||
|
|
Loading…
Reference in a new issue