Fixed two bugs (see description)

1. After drawing a shape, if you release the mouse button and click
down again without moving it, you still retain control of the shape you
should have finished drawing. A new shape should be started as soon as
you release the mouse button.

2. While drawing a shape, if you leave the canvas area and release the
mouse button and move back into the canvas area, you still retain
control of the shape even though the mouse is not pressed. To finish
drawing, you need to click the mouse button again. Changed this so that
as soon as you move out of canvas, the shape being drawn is finished.