Calculating the size of the canvas