diff --git a/lib/core/src/lib/viewer/components/img-viewer.component.spec.ts b/lib/core/src/lib/viewer/components/img-viewer.component.spec.ts index 55e72d0521..fe897a48c9 100644 --- a/lib/core/src/lib/viewer/components/img-viewer.component.spec.ts +++ b/lib/core/src/lib/viewer/components/img-viewer.component.spec.ts @@ -369,6 +369,17 @@ describe('Test Img viewer component ', () => { expect(component.isSaving.emit).toHaveBeenCalledWith(true); expect(component.isSaving.emit).toHaveBeenCalledWith(false); })); + + it('should reset the viewer after going to full screen mode', () => { + Object.defineProperty(document, 'fullscreenElement', { + value: true + }); + spyOn(component, 'reset'); + + document.dispatchEvent(new Event('fullscreenchange')); + + expect(component.reset).toHaveBeenCalled(); + }); }); }); diff --git a/lib/core/src/lib/viewer/components/img-viewer.component.ts b/lib/core/src/lib/viewer/components/img-viewer.component.ts index f5d15f0b71..3ca3aabf69 100644 --- a/lib/core/src/lib/viewer/components/img-viewer.component.ts +++ b/lib/core/src/lib/viewer/components/img-viewer.component.ts @@ -141,6 +141,13 @@ export class ImgViewerComponent implements AfterViewInit, OnChanges, OnDestroy { } } + @HostListener('document:fullscreenchange') + fullScreenChangeHandler() { + if(document.fullscreenElement) { + this.reset(); + } + } + ngOnChanges(changes: SimpleChanges) { const blobFile = changes['blobFile']; if (blobFile && blobFile.currentValue) {