How to draw custom lines on top of UI Grid

Hello,
I want to achieve the same result as the image attached, basically, I have a grid layout and I want to draw a Line while dragging, while I have no problem getting the position or each object in the grid, I have no idea how to draw a line like that between the objects.
Especially because the start and the end of the line have rounded shapes.

I had a look at the line rendered component bug that doesn’t work on the unity Ui system, can someone point me in the right direction?

8278929--1084986--Screenshot 2022-07-14 at 20.05.48.png

One way would be using a 9-slice image and little bit of math to calculate the rotation angle and endpoint offsets. Preferably the the line thickness in sprite should be the same as what you use when drawing. Changing thickness is little bit tricky but doable (requires modifiying pixels per unit multiplier or scale in combination with rect dimensions to ensure that ends don’t stretch). But in case of game like you showed there shouldn’t be issue preparing appropriate size sprite.

This seems a nice solution that can sole the problem of having a sprite with rounded corners, but once I have a sprite sliced, what is the best solution to draw ot on the screen onto of the UI?