Press M to switch between Drawing mode and Movement mode. In Drawing mode, click to draw lines. In Movement mode, hold left click to move the circle to your mouse, and watch as it collides with the lines you just drew.
This is quite over-engineered and pretty inefficient, but hey, it works. Feel free to look through the code and tell me how I could make it better. How does it work? Well it checks if the circle touches the lines, and stores a list of points where it makes contact. Then it finds the 2 points which are furthest away from each other, and gets the point between them, let's call that point A. It checks the distance between the circle's middle and point A, and uses that to find the distance the circle should be "pushed back". This can be chained with multiple circles (or so I think) for use in games. You can use this in your games if you give me credit, although I don't see how this slow, buggy and janky approach would be useful.