Correctly initialize 2d canvas when container has display none.