RED-7296: implemented rectangle deletion by pressing esc.
This commit is contained in:
parent
3b10682041
commit
44bda08834
@ -11,6 +11,7 @@ import { JustificationsService } from '@services/entity-services/justifications.
|
||||
import { Roles } from '@users/roles';
|
||||
import { firstValueFrom } from 'rxjs';
|
||||
import { ManualRedactionService } from '../../services/manual-redaction.service';
|
||||
import { REDAnnotationManager } from '../../../pdf-viewer/services/annotation-manager.service';
|
||||
|
||||
export interface LegalBasisOption {
|
||||
label?: string;
|
||||
@ -40,6 +41,7 @@ export class ManualAnnotationDialogComponent extends BaseDialogComponent impleme
|
||||
activeDossiersService: ActiveDossiersService,
|
||||
private readonly _dictionaryService: DictionaryService,
|
||||
protected readonly _dialogRef: MatDialogRef<ManualAnnotationDialogComponent>,
|
||||
private readonly _annotationManager: REDAnnotationManager,
|
||||
@Inject(MAT_DIALOG_DATA) readonly data: { manualRedactionEntryWrapper: ManualRedactionEntryWrapper; dossierId: string; file: File },
|
||||
) {
|
||||
super(_dialogRef);
|
||||
@ -111,6 +113,13 @@ export class ManualAnnotationDialogComponent extends BaseDialogComponent impleme
|
||||
}
|
||||
}
|
||||
|
||||
close() {
|
||||
super.close();
|
||||
if (this.isRectangle) {
|
||||
this._annotationManager.delete(this._annotationManager.selected[0].Id);
|
||||
}
|
||||
}
|
||||
|
||||
#getRectangles() {
|
||||
const quads = this.data.manualRedactionEntryWrapper.manualRedactionEntry.positions.find(a => !!a);
|
||||
const value: string = this.form.get('multiplePages').value.replace(/[^0-9-,]/g, '');
|
||||
|
||||
@ -181,6 +181,8 @@ export class FilePreviewScreenComponent
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.#handleDeleteRectangleOnEsc();
|
||||
}
|
||||
|
||||
get changed() {
|
||||
@ -586,6 +588,20 @@ export class FilePreviewScreenComponent
|
||||
return newAnnotations;
|
||||
}
|
||||
|
||||
#handleDeleteRectangleOnEsc() {
|
||||
this.pdf.instance.UI.hotkeys.on('esc', e => {
|
||||
e.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();
|
||||
|
||||
|
||||
@ -266,12 +266,18 @@ export class PdfViewer {
|
||||
}
|
||||
|
||||
#listenForEsc() {
|
||||
this.#instance.UI.hotkeys.on('esc', e => {
|
||||
e.preventDefault();
|
||||
if (this.#isElementActive('searchPanel') && !this._annotationManager.resizingAnnotationId) {
|
||||
this.#focusViewer();
|
||||
this.deactivateSearch();
|
||||
}
|
||||
this.#instance.UI.hotkeys.on('esc', {
|
||||
keydown: e => {
|
||||
e.preventDefault();
|
||||
},
|
||||
keyup: e => {
|
||||
e.preventDefault();
|
||||
if (this.#isElementActive('searchPanel') && !this._annotationManager.resizingAnnotationId) {
|
||||
this.#focusViewer();
|
||||
this.deactivateSearch();
|
||||
}
|
||||
this.#clickSelectToolButton();
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@ -382,4 +388,9 @@ export class PdfViewer {
|
||||
this.instance.UI.iframeWindow.document.getElementById('SearchPanel__input').blur();
|
||||
this.instance.UI.iframeWindow.focus();
|
||||
}
|
||||
|
||||
#clickSelectToolButton() {
|
||||
const selectButton = this.instance.UI.iframeWindow.document.querySelector('[data-element="selectToolButton"]') as HTMLElement;
|
||||
selectButton.click();
|
||||
}
|
||||
}
|
||||
|
||||
@ -65,6 +65,7 @@ export const DISABLED_HOTKEYS = [
|
||||
'SPACE',
|
||||
'UP',
|
||||
'DOWN',
|
||||
'ESCAPE',
|
||||
'R',
|
||||
'P',
|
||||
'A',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user