Merge branch 'master' into VM/DM-508
This commit is contained in:
commit
80fa240731
@ -7,6 +7,7 @@
|
||||
<ng-container *ngIf="resizing && annotationPermissions.canResizeAnnotation">
|
||||
<iqser-circle-button
|
||||
(action)="acceptResize()"
|
||||
*ngIf="resized"
|
||||
[tooltipPosition]="tooltipPosition"
|
||||
[tooltip]="'annotation-actions.resize-accept.label' | translate"
|
||||
[type]="buttonType"
|
||||
|
||||
@ -82,6 +82,10 @@ export class AnnotationActionsComponent implements OnChanges {
|
||||
return this.#annotations?.length === 1 && this.#annotations?.[0].id === this._annotationManager.resizingAnnotationId;
|
||||
}
|
||||
|
||||
get resized() {
|
||||
return this._annotationManager.annotationHasBeenResized;
|
||||
}
|
||||
|
||||
get #sameType() {
|
||||
const type = this.annotations[0].superType;
|
||||
return this.annotations.every(a => a.superType === type);
|
||||
|
||||
@ -272,6 +272,7 @@ export class AnnotationActionsService {
|
||||
|
||||
async cancelResize(annotationWrapper: AnnotationWrapper) {
|
||||
this._annotationManager.resizingAnnotationId = undefined;
|
||||
this._annotationManager.annotationHasBeenResized = false;
|
||||
this._annotationManager.delete(annotationWrapper);
|
||||
await this._annotationDrawService.draw([annotationWrapper], this._skippedService.hideSkipped(), this._state.dossierTemplateId);
|
||||
this._annotationManager.deselect();
|
||||
|
||||
@ -40,7 +40,7 @@ export class PdfAnnotationActionsService {
|
||||
this.#annotationActionsService.cancelResize(firstAnnotation),
|
||||
);
|
||||
|
||||
return [acceptResizeButton, cancelResizeButton];
|
||||
return this.#annotationManager.annotationHasBeenResized ? [acceptResizeButton, cancelResizeButton] : [cancelResizeButton];
|
||||
}
|
||||
|
||||
const resizeButton = this.#getButton('resize', _('annotation-actions.resize.label'), () =>
|
||||
|
||||
@ -306,10 +306,7 @@ export class PdfProxyService {
|
||||
nextAnnotations = this._annotationManager.selected;
|
||||
}
|
||||
|
||||
const annotationWasResized = this._annotationManager.resizingAnnotationId && action === 'modify';
|
||||
if (!this._annotationManager.resizingAnnotationId || annotationWasResized) {
|
||||
this.#configureAnnotationSpecificActions(nextAnnotations);
|
||||
}
|
||||
this.#configureAnnotationSpecificActions(nextAnnotations);
|
||||
|
||||
if (!(annotations.length === 1 && annotations[0].ReadOnly)) {
|
||||
this._pdf.enable(TextPopups.ADD_RECTANGLE);
|
||||
|
||||
@ -11,6 +11,10 @@ import { AnnotationPredicate, DeleteAnnotationsOptions } from '../utils/types';
|
||||
import AnnotationManager = Core.AnnotationManager;
|
||||
import Annotation = Core.Annotations.Annotation;
|
||||
|
||||
const MODIFY_ACTION = 'modify';
|
||||
const RESIZE_OPTION = 'resize';
|
||||
const MOVE_OPTION = 'move';
|
||||
|
||||
@Injectable()
|
||||
export class REDAnnotationManager {
|
||||
readonly #hidden = signal(new Set<string>());
|
||||
@ -19,6 +23,7 @@ export class REDAnnotationManager {
|
||||
readonly #annotationSelected$ = new Subject<[Annotation[], string]>();
|
||||
readonly annotationSelected$ = this.#annotationSelected$.asObservable();
|
||||
resizingAnnotationId?: string = undefined;
|
||||
annotationHasBeenResized?: boolean = false;
|
||||
readonly hidden = this.#hidden.asReadonly();
|
||||
|
||||
get selected() {
|
||||
@ -146,6 +151,11 @@ export class REDAnnotationManager {
|
||||
#autoSelectRectangleAfterCreation() {
|
||||
this.#manager.addEventListener('annotationChanged', (annotations: Annotation[], action: string, options) => {
|
||||
this.#logger.info('[ANNOTATIONS] Annotations changed: ', annotations, action, options);
|
||||
|
||||
if (action === MODIFY_ACTION && (options.source === RESIZE_OPTION || options.source === MOVE_OPTION)) {
|
||||
this.annotationHasBeenResized = true;
|
||||
}
|
||||
|
||||
// when a rectangle is drawn,
|
||||
// it returns one annotation with tool name 'AnnotationCreateRectangle;
|
||||
// this will auto select rectangle after drawing
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user