RED-5820: cancel resize on annotation deselect
This commit is contained in:
parent
f47e81abd9
commit
2bff5039e8
@ -29,6 +29,7 @@ import { AnnotationsListingService } from './annotations-listing.service';
|
||||
import { PdfAnnotationActionsService } from './pdf-annotation-actions.service';
|
||||
import { DictionariesMapService } from '@services/entity-services/dictionaries-map.service';
|
||||
import { ROLES } from '@users/roles';
|
||||
import { AnnotationActionsService } from './annotation-actions.service';
|
||||
import Annotation = Core.Annotations.Annotation;
|
||||
import Quad = Core.Math.Quad;
|
||||
|
||||
@ -57,6 +58,7 @@ export class PdfProxyService {
|
||||
@Inject(BASE_HREF_FN) private readonly _convertPath: BaseHrefFn,
|
||||
private readonly _translateService: TranslateService,
|
||||
private readonly _manualRedactionService: ManualRedactionService,
|
||||
private readonly _annotationsActionsService: AnnotationActionsService,
|
||||
private readonly _ngZone: NgZone,
|
||||
private readonly _userPreferenceService: UserPreferenceService,
|
||||
private readonly _annotationDrawService: AnnotationDrawService,
|
||||
@ -119,6 +121,7 @@ export class PdfProxyService {
|
||||
let nextAnnotations: Annotation[];
|
||||
|
||||
if (action === 'deselected') {
|
||||
this.#cancelResizeIfIsResizing(annotations);
|
||||
// Remove deselected annotations from selected list
|
||||
nextAnnotations = this._annotationManager.selected.filter(ann => !annotations.some(a => a.Id === ann.Id));
|
||||
this._pdf.disable(TextPopups.ADD_RECTANGLE);
|
||||
@ -152,10 +155,20 @@ export class PdfProxyService {
|
||||
return nextAnnotations.map(ann => ann.Id);
|
||||
}
|
||||
|
||||
#cancelResizeIfIsResizing(annotations: Annotation[]) {
|
||||
if (annotations.length !== 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
const annotation = this._fileDataService.find(annotations[0].Id);
|
||||
if (annotation?.resizing) {
|
||||
this._annotationsActionsService.cancelResize(null, annotation).then();
|
||||
}
|
||||
}
|
||||
|
||||
private _configureElements() {
|
||||
const color = this._annotationDrawService.convertColor(
|
||||
this._dictionariesMapService.get(this._state.dossierTemplateId, 'manual').hexColor,
|
||||
);
|
||||
const hexColor = this._dictionariesMapService.get(this._state.dossierTemplateId, 'manual').hexColor;
|
||||
const color = this._annotationDrawService.convertColor(hexColor);
|
||||
this._documentViewer.setRectangleToolStyles(color);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user