/** override functions */ public virtual bool TouchBegan(CCTouch pTouch, CCEvent touchEvent) { if (!Visible) { return(false); } var frame = ViewRect; //dispatcher does not know about clipping. reject _touches outside visible bounds. if (_touches.Count > 2 || IsTouchMoved || !frame.ContainsPoint(_container.Layer.ScreenToWorldspace(pTouch.LocationOnScreen))) { return(false); } if (!_touches.Contains(pTouch)) { _touches.Add(pTouch); } if (_touches.Count == 1) { // scrolling _touchPoint = Layer.ScreenToWorldspace(pTouch.LocationOnScreen); IsTouchMoved = false; Dragging = true; //Dragging started _dragginStartTime = DateTime.Now; _scrollDistance = CCPoint.Zero; _touchLength = 0.0f; } else if (_touches.Count == 2) { _touchPoint = CCPoint.Midpoint(Layer.ScreenToWorldspace(_touches[0].LocationOnScreen), Layer.ScreenToWorldspace(_touches[1].LocationOnScreen)); _touchLength = CCPoint.Distance(_container.Layer.ScreenToWorldspace(_touches[0].LocationOnScreen), _container.Layer.ScreenToWorldspace(_touches[1].LocationOnScreen)); Dragging = false; } return(true); }