public override void OnTouch(Input input, TouchMoveEventArgs eventArgs) { if (input.NumTouches == 1) { if (Camera.Zoom == 1) { // Don't scroll carousel if there is only one camera in the system if (ItemCount == 1) { return; } if (Math.Abs(eventArgs.DX) > swipeThreshold && swipeSelectionThrottle < Time.SystemTime) { swipeSelectionThrottle = Time.SystemTime + 500; SelectNeighbour(eventArgs.DX > swipeThreshold); return; } // We want to scroll Offset += eventArgs.DX * scrollSpeed; double deltaTime = Time.SystemTime - touchThrottleTime; if (eventArgs.DX > 0) { swipingDirection = SwipingDirection.RIGHT; } else if (eventArgs.DX < 0) { swipingDirection = SwipingDirection.LEFT; } // Check if we are panning or just scrolling the carousel // based on current zoom if (deltaTime > 200) { // If the offset is greater than half the screen distance then the neighbouring camera is closer // to the center and thus is selected. if (Math.Abs(Offset) > Math.Abs(halfScreenDistance)) { SelectNeighbour(Offset > halfScreenDistance); } touchThrottleTime = Time.SystemTime; } } else { // We want to Pan Camera.Pan(eventArgs.DX, eventArgs.DY, 0.005f, true, CameraManager.CurrentCamera.Screen.Height / 2, -CameraManager.CurrentCamera.Screen.Height / 2, CameraManager.CurrentCamera.Screen.Width / 2, -CameraManager.CurrentCamera.Screen.Width / 2); } } else if (input.NumTouches >= 2) { // Get Touchstates TouchState fingerOne = input.GetTouch(0); TouchState fingerTwo = input.GetTouch(1); Camera.Zoom += Gestures.GetZoomAmountFromPinch(fingerOne, fingerTwo) * 0.2f; if (Camera.Zoom < 1) { Camera.Zoom = 1; // Reset panning instantly instead of waiting for next finger touch Camera.Pan(eventArgs.DX, eventArgs.DY); } } }