[AAE-14759] Fixed image viewer when going to full screen mode (#8609)

This commit is contained in:
Ehsan Rezaei
2023-05-31 13:12:09 +02:00
committed by GitHub
parent 46efc4f7ea
commit 7355216034
2 changed files with 18 additions and 0 deletions

View File

@@ -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();
});
});
});

View File

@@ -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) {