Emberveil sourcemobile/java/MobileUi.java
/** Browser gestures use the same interface coordinates and bounds as the client renderer. */
final class MobileUi {
static boolean scroll(RSInterface widget,int originX,int originY,int x,int y,int delta,int depth){
if(widget==null||depth>12||widget.type!=0||widget.aBoolean266
||x<originX||y<originY||x>=originX+widget.width||y>=originY+widget.height)return false;
if(widget.children!=null&&widget.childX!=null&&widget.childY!=null){
for(int i=Math.min(widget.children.length,Math.min(widget.childX.length,widget.childY.length))-1;i>=0;i--){
int id=widget.children[i];
if(id<0||id>=RSInterface.interfaceCache.length)continue;
RSInterface child=RSInterface.interfaceCache[id];if(child==null)continue;
int childX=originX+widget.childX[i]+child.anInt263;
int childY=originY+widget.childY[i]+child.anInt265-widget.scrollPosition;
if(scroll(child,childX,childY,x,y,delta,depth+1))return true;
}
}
if(widget.scrollMax<=widget.height)return false;
widget.scrollPosition=Math.max(0,Math.min(widget.scrollMax-widget.height,widget.scrollPosition+delta));
return true;
}
}