Auto resize canvas when the size change.