3D viewer: fix broken controls when embedded in dialog

To make the controls work, the correct dimensions of the webgl DOM
element have to be available. This is done after a resize, but a resize
doesn't happen for a dialog. Therefore, controls are now initialized
after the renderer's DOM element has been added to the DOM. This makes
the container's size correct already when the controls are initialized.

Fixes #823.