RED-4346: fix value after rectangle resize

This commit is contained in:
Dan Percic 2022-06-23 20:32:24 +03:00
parent d9e1d57448
commit ae88ef2564

View File

@ -420,7 +420,7 @@ export class AnnotationActionsService {
async acceptResize($event: MouseEvent, annotation: AnnotationWrapper): Promise<void> {
const fileId = this._state.fileId;
const textAndPositions = await this._extractTextAndPositions(annotation.id);
const text = annotation.value === 'Rectangle' ? 'Rectangle' : annotation.isImage ? 'Image' : textAndPositions.text;
const text = annotation.rectangle ? annotation.value : annotation.isImage ? 'Image' : textAndPositions.text;
const data = { annotation, text };
this._dialogService.openDialog('resizeAnnotation', $event, data, (result: { comment: string; updateDictionary: boolean }) => {
const resizeRequest: IResizeRequest = {
@ -572,17 +572,18 @@ export class AnnotationActionsService {
text: words.join(' '),
positions: rectangles,
};
} else {
const rect = toPosition(
viewerAnnotation.getPageNumber(),
this._documentViewer.getHeight(viewerAnnotation.getPageNumber()),
this._annotationDrawService.annotationToQuads(viewerAnnotation),
);
return {
positions: [rect],
text: null,
};
}
const position = toPosition(
viewerAnnotation.getPageNumber(),
this._documentViewer.getHeight(viewerAnnotation.getPageNumber()),
this._annotationDrawService.annotationToQuads(viewerAnnotation),
);
return {
positions: [position],
text: null,
};
}
private async _extractTextFromRect(page: Core.PDFNet.Page, rect: Core.PDFNet.Rect) {