There are some steps you need to follow
- Create a canvas and use the mouse handler to capture the points for drawing the line
- Use those points to calculate euclidean distance between two positions will give you the length
- Using trigonometry, you can calculate the corner between two points