Prevented layer from drawing outside the canvas