diff --git a/apps/red-ui/src/app/modules/file-preview/file-preview-screen.component.ts b/apps/red-ui/src/app/modules/file-preview/file-preview-screen.component.ts index e782c483a..99358859d 100644 --- a/apps/red-ui/src/app/modules/file-preview/file-preview-screen.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/file-preview-screen.component.ts @@ -311,6 +311,19 @@ export class FilePreviewScreenComponent } } + @Bind() + handleDeleteRectangleOnEsc($event: KeyboardEvent) { + $event.preventDefault(); + if (!!this._annotationManager.selected[0]) { + const doesHaveWrapper = this._fileDataService.find(this._annotationManager.selected[0]?.Id); + if (!doesHaveWrapper) { + this._annotationManager.delete(this._annotationManager.selected[0]?.Id); + } else { + this._annotationManager.deselect(this._annotationManager.selected[0]?.Id); + } + } + } + async ngOnAttach(previousRoute: ActivatedRouteSnapshot) { if (!this.state.file().canBeOpened) { return this.#navigateToDossier(); @@ -343,8 +356,7 @@ export class FilePreviewScreenComponent this.pdfProxyService.configureElements(); this.#restoreOldFilters(); document.documentElement.addEventListener('fullscreenchange', this.fullscreenListener); - this.pdf.instance.UI.hotkeys.on('esc', this.#handleDeleteRectangle); - + this.pdf.instance.UI.hotkeys.on('esc', this.handleDeleteRectangleOnEsc); this.#openComponentLogDialogIfDefault(); this._viewerHeaderService.resetLayers(); } @@ -589,18 +601,6 @@ export class FilePreviewScreenComponent return newAnnotations; } - #handleDeleteRectangle($event: KeyboardEvent) { - $event.preventDefault(); - if (!!this._annotationManager.selected[0]) { - const doesHaveWrapper = this._fileDataService.find(this._annotationManager.selected[0]?.Id); - if (!doesHaveWrapper) { - this._annotationManager.delete(this._annotationManager.selected[0]?.Id); - } else { - this._annotationManager.deselect(this._annotationManager.selected[0]?.Id); - } - } - } - #rebuildFilters() { const startTime = new Date().getTime();