Resize the zoom box width to fit the content - fix embedding

This PR is a follow-up of #2612, since that one break the zoom box if the viewer is embedded.
This patch fixes #2793, thanks @timvandermeij for reporting this issue.