call a function depends on the mouse position on a button?

ok let’s say i have 2 functions,

public void a()
{

    Debug.Log("left");
}

public void b()
{

    Debug.Log("right");
}

how can i do this ?

 //if (cursor position is on the left side of the button when you click  ){
 //a();
 //}

 //else  if (cursor position is on the right side of the button when you click   ){
   //b();
   //}

144697-untitled.png

any idea???

##Method A

So here is a simple way to get it to work on a single button based on the inputs position.

    public Button MyButton;
    private RectTransform _buttonRect;
    
    void Start()
    {

        _buttonRect = MyButton.GetComponent<RectTransform>();

        MyButton.onClick.AddListener(() => {

            if(_buttonRect.sizeDelta.x * 0.5 > Input.mousePosition.x)
            {
                Debug.Log("Left Side");
            }
            else {
                Debug.Log("Right");
            }
        });
    }