Help needed with camera zoom script.

So basically the problem here is that when i use mathf.clamp it jump back and forth from the min and max value. any idea why?

public class CameraZoom : MonoBehaviour
{
public float scrollInput;
public float zoomSensitivity;
public float maxZoomDis;
public float minZoomDis;
public float curCamPos;
public Transform mainCamera;

private void Start()
{
scrollInput = Input.GetAxis(“Mouse ScrollWheel”);
}

void LateUpdate()
{

curCamPos = Mathf.Clamp(curCamPos, -minZoomDis, -maxZoomDis);
Vector3 zoomDistance = mainCamera.transform.position;
zoomDistance.z = curCamPos;
mainCamera.transform.position = zoomDistance;

if (Input.GetAxis(“Mouse ScrollWheel”) < 0)
{
zoomDistance.z += zoomSensitivity * scrollInput;
}

if (Input.GetAxis(“Mouse ScrollWheel”) > 0)
{
zoomDistance.z += zoomSensitivity * scrollInput;
}

}
}

Fixed the issue by fliping the max and min values, apparently if you have your max value as -15 and min as -3 it starts jumping back and forth.