How to limit object rotation?

I’m rotating my object with Mouse Drag,
and limited its rotation at certain angle,
I can rotate it on counter clockwise

28941-untitled.png

but i cant rotate it the oppisite direction (clockwise) somthing like this

28942-untitled1.png

How can I be able to rotate it on both direction but with limiting at certain angle like both images???

the following code is attached with object…`

public class MouseDrag : MonoBehaviour
{
	
	private float baseAngle = 0.0f;
	private float maxRotaion = 60f;
		


	void Start()
	{

		}
		void OnMouseDown ()
		{

		 
		var dir = Camera.main.WorldToScreenPoint (transform.position);
		dir = Input.mousePosition - dir;
		baseAngle = Mathf.Atan2(dir.y, dir.x) * Mathf.Rad2Deg;
		baseAngle -= Mathf.Atan2(transform.right.y, transform.right.x) * Mathf.Rad2Deg;
		}

		void OnMouseDrag ()
		{

		// Limit platform rotation
		if (transform.rotation.eulerAngles.z <= maxRotaion ) {
						var dir = Camera.main.WorldToScreenPoint (transform.position);
						dir = Input.mousePosition - dir;
						var angle = Mathf.Atan2 (dir.y, dir.x) * Mathf.Rad2Deg - baseAngle;

						transform.rotation = Quaternion.AngleAxis (angle, Vector3.forward);

						

		}		
}

// Limit rotation
void OnMouseDrag (){
var dir = Camera.main.WorldToScreenPoint (transform.position);
dir = Input.mousePosition - dir;
var angle = Mathf.Atan2 (dir.y, dir.x) * Mathf.Rad2Deg - baseAngle;

		if (angle >= -maxRotaion && angle <= maxRotaion)
			transform.rotation = Quaternion.AngleAxis (angle, Vector3.forward);
	}

Cheers,
Radivarig