How do you stop touch[].phase when using Joystick prefab?

I have a camera that rotates around the player only in x axis when you swipe on the screen. I have two buttons and a joystick prefab on the UI. I don't want the camera to move when touch.phase is initiated on any of the UI elements.

This is what I have done so far:

Touch[] touch = Input.touches;
if (touch[0].phase == TouchPhase.Moved
&& !Joystick.UseX && !Joystick.UseY
&& !CrossPlatformInputManager.GetButton("Jump")
&& !CrossPlatformInputManager.GetButton("Boost"))
{
delta = touch[0].deltaPosition;
}
else delta.x = 0;


This code works fine on jump and boost buttons.

Joystick.UseX and UseY are two booleans I added to Joystick.cs so that when no input is taken from them, they will become false. The code would work, but the problem is that when you touch the joystick, no input will be taken, until you drag it around. When you drag it, as every condition is met in my if statement, the camera starts moving.

Can you help build on my code to fix it or give me a better solution?