File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -18,9 +18,18 @@ void GenericContentLayer::setPosition(CCPoint const& pos) {
18
18
// all be TableViewCells
19
19
CCLayerColor::setPosition (pos);
20
20
21
+ CCSize scrollLayerSize{};
22
+ if (auto parent = this ->getParent ()) {
23
+ scrollLayerSize = parent->getContentSize ();
24
+ }
25
+
21
26
for (auto child : CCArrayExt<CCNode*>(m_pChildren)) {
22
- auto y = this ->getPositionY () + child->getPositionY ();
23
- child->setVisible (!((m_obContentSize.height < y) || (y < -child->getContentSize ().height )));
27
+ float childY = this ->getPositionY () + child->getPositionY ();
28
+ float childTop = childY + (1 .f - child->getAnchorPoint ().y ) * child->getScaledContentSize ().height ;
29
+ float childBottom = childY - child->getAnchorPoint ().y * child->getScaledContentSize ().height ;
30
+ bool visible = childTop > 0 && childBottom < scrollLayerSize.height ;
31
+
32
+ child->setVisible (visible);
24
33
}
25
34
}
26
35
You can’t perform that action at this time.
0 commit comments