예제 #1
0
bool CCScrollView::isNodeFullyVisible(CCNode* node) {
    const CCPoint offset = this->getContentOffset();
    const CCSize  size   = this->getViewSize();
    const float   scale  = this->getZoomScale();
    
    CCRect viewRect;
    
    viewRect = CCRectMake(-offset.x/scale, -offset.y/scale, size.width/scale, size.height/scale);
    
    CCRect nodeBound = CCRectMake(0, 0, node->getContentSize().width, node->getContentSize().height);
    CCAffineTransform t = node->nodeToAncestorTransform(getContainer());
    nodeBound = CCRectApplyAffineTransform(nodeBound, t);
    return viewRect.containsRect(nodeBound);
}