Ensuring canvas resize only once