protected static Layer layerUnderPoint (Layer layer, Point pt) {
    float x = pt.x, y = pt.y;
    if (layer instanceof GroupLayer) {
      GroupLayer gl = (GroupLayer)layer;
      for (int ii = gl.children()-1; ii >= 0; ii--) {
        Layer child = gl.childAt(ii);
        if (!child.visible()) continue; // ignore invisible children
        try {
          // transform the point into the child's coordinate system
          child.transform().inverseTransform(pt.set(x, y), pt);
          pt.x += child.originX();
          pt.y += child.originY();
          Layer l = layerUnderPoint(child, pt);
          if (l != null)
          return l;
        } catch (NoninvertibleTransformException nte) {
          continue;
        }
      }
    }
    if (x >= 0 && x < layer.width() && y >= 0 && y < layer.height()) {
      return layer;
    }
    return null;
  }
protected static Layer layerUnderPoint ( Layer layer , Point pt ) { float x = pt . x , y = pt . y ; if ( layer instanceof GroupLayer ) { GroupLayer gl = ( GroupLayer ) layer ; for ( int ii = gl . children ( ) - 1 ; ii >= 0 ; ii -- ) { Layer child = gl . childAt ( ii ) ; if ( ! child . visible ( ) ) continue ; try { child . transform ( ) . inverseTransform ( pt . set ( x , y ) , pt ) ; pt . x += child . originX ( ) ; pt . y += child . originY ( ) ; Layer l = layerUnderPoint ( child , pt ) ; if ( l != null ) return l ; } catch ( NoninvertibleTransformException nte ) { continue ; } } } if ( x >= 0 && x < layer . width ( ) && y >= 0 && y < layer . height ( ) ) { return layer ; } return null ; }
Performs the recursion for {@link #layerUnderPoint(Layer,float,float)}.