trouble with input touches

hi everybody, i have some trouble with properly identifying touches on tablet.
basically i need to have just one tap, tap hold and rotate (or slide) and slide with two fingers…

the code i have works fine for slide with two fingers. it works when i want to rotate camera
but when i lift the finger if object is below the finger it will get selected. i want to avoid this

here is the code:

//IF WE HAVE TWO TOUCHES AND WE HAVE MOVEMENT OF BOTH OF THEM
	if(Input.touchCount>1 && Input.GetTouch(0).phase == TouchPhase.Moved && Input.GetTouch(1).phase == TouchPhase.Moved){
	
		distance += Input.GetTouch(0).deltaPosition.y*0.01;
	
	//IF WE HAVE ONE TOUCH AND WE DO NOT HAVE MOVEMENT
	}
	
	if(Input.touchCount == 1 && Input.GetTouch(0).phase == TouchPhase.Moved) {
    
		touchDeltaPosition = Input.GetTouch(0).deltaPosition;
	   
		x += touchDeltaPosition.x * xSpeed*0.003; 
		y -= touchDeltaPosition.y * ySpeed*0.003; 
		
	}
	
	//IF WE HAVE JUST ONE CLICK
	if(Input.touchCount == 1 && Input.GetTouch(0).phase == TouchPhase.Ended){
	
		var hit : RaycastHit;
			
		//CHECK IF WE HIT SOMETHING WITH RAY FROM THE TOUCH POSITION TO INFINITY
		if(Physics.Raycast(Camera.main.ScreenPointToRay(Input.GetTouch(0).position),hit,100)){
					
			//DO SOMETHING

		}
		
	}

any ideas appreciated!

cross post to forum: http://forum.unity3d.com/threads/105585-trouble-with-input.touches?p=696947#post696947

From what I can tell, your code is not preventing the single touch action from occurring at the end of a drag. A simple solution is to only allow the “one click” action to occur when the movement amount (since the beginning of the touch) is under a certain threshold (say less than 10 pixels). If you track each touch starting with TouchPhase.Began you can distinguish better between a single touch, a drag or multitouch event.