Fixed a viewer resizing bug when switching between layers.