RED-7296: fix.

This commit is contained in:
Nicoleta Panaghiu 2024-02-06 14:37:13 +02:00
parent 75ce020cb5
commit b8ae06f38e

View File

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