finding distance between two sets of coordinates in UI

really dumb question, but I’m trying to align my viewport with a widget at runtime so that the button sits in the center of the screen.

I started by finding the screen dimensions and halving them. Then i found the position of my widget in screen space.

Then I assumed just finding the distance between the two sets of coordinates and then adding the result to the canvas position? Is this logic correct? - if so does anyone know an easy way of achieving this?

thanks,
Sam

man this forum is deadly