Could you please be more specific about what it is that you want? It sounds as if you want the user to draw a shape that is like an “L” with two segments forming a 90-degree angle. Maybe you also want those two segments to be at multiples of 90 degrees?
It really would help if you could show a sequence of sketches or screenshots for how you want it to behave and what the result will be used for.