Sprite.hitTestTouchDispatch C# (CSharp) Method

hitTestTouchDispatch() public method

public hitTestTouchDispatch ( string type, Touch touch ) : bool
type string
touch Touch
return bool
    public override bool hitTestTouchDispatch(string type,Touch touch)
    {
        if(!mouseEnable || !_visible){
            return false;
        }
        Vector2 vec = new Vector2(touch.position.x,Stage.instance.stageHeight- touch.position.y);
        Vector2 newVec = transformInTreeInverted.transformVector(vec);

        if(!_boundRectInTree.Contains(vec)){
            return false;
        }
        bool isHit = false;
        if(_textureSelfRect.width!=0 && _textureSelfRect.height!=0 && _textureSelfRect.Contains(newVec)){
            isHit = true;
        }

        DisplayObject child;
        for(int i=_childList.Count-1;i>=0;i--){
            child	= _childList[i] as DisplayObject;
            if(child.hitTestTouchDispatch(type,touch)){
                isHit	= true;
                break;
            }

        }
        if(isHit){
            _touchList.Add(touch);
            this.dispatchEvent(new TouchEvent(type,touch));
        }
        return isHit;
    }