How to check weather a touch pos is in view or not?

Here is a problem.

layers

l1 and l2 are layers that has been clipped(such as ScrollView, TableView or ClipNode).
l2 is a child of l1.
l2 was clipped again by l1.
How to check a point(like B or C) is in view area of l2?

process like this:

function isInLayerViewArea(worldPos, layer) {
    var node = layer, insitePos;
    while (node is not the root) {
        insitePos = node.converToNodeSpace(worldPos);
        if (node is clipped && insitePos is not in clipped area of node) {
             return false;
        }
        node = node.getParent()
    }
    return true;
}

ps:in scrollview or clipnode, EGLView::getInstance()->setScissorInPoints is used to clipped drawing.

could someone gives some suggestion?


layers.jpg (16.9 KB)

ScorllView(or tableView) contains one or more ScrollView(or tableView) as child may meet the problem.