RED-5907 - Remove Rotate-Buttons in DELTA- and PREVIEW-View

This commit is contained in:
Valentin Mihai 2023-01-06 17:02:34 +02:00
parent 9475438d3b
commit 4d73198465
3 changed files with 28 additions and 9 deletions

View File

@ -685,6 +685,15 @@ export class FilePreviewScreenComponent
.subscribe();
this.addActiveScreenSubscription = this._readableRedactionsService.active$.pipe(switchMap(() => this.updateViewMode())).subscribe();
this.addActiveScreenSubscription = this._viewModeService.viewMode$
.pipe(
tap(viewMode =>
viewMode === 'STANDARD' || viewMode === 'TEXT_HIGHLIGHTS'
? this._viewerHeaderService.enableRotationButtons()
: this._viewerHeaderService.disableRotationButtons(),
),
)
.subscribe();
}
private _handleDeletedDossier(): void {

View File

@ -6,7 +6,7 @@ import { BASE_HREF_FN, BaseHrefFn, IqserPermissionsService } from '@iqser/common
import { TooltipsService } from './tooltips.service';
import { PageRotationService } from './page-rotation.service';
import { PdfViewer } from './pdf-viewer.service';
import { ROTATION_ACTION_BUTTONS, ViewerEvents } from '../utils/constants';
import { ROTATION_ACTION_BUTTONS, ROTATION_BUTTONS, ViewerEvents } from '../utils/constants';
import { FilesMapService } from '@services/files/files-map.service';
import { REDDocumentViewer } from './document-viewer.service';
import { UserPreferenceService } from '@users/user-preference.service';
@ -161,15 +161,17 @@ export class ViewerHeaderService {
cursor: pointer;
opacity: 0.7;
`;
paragraph.addEventListener('click', () => {
this._rotationService.discardRotation();
this.disable(ROTATION_ACTION_BUTTONS);
});
paragraph.addEventListener('click', () => this.#discardRotation());
return paragraph;
},
};
}
#discardRotation(): void {
this._rotationService.discardRotation();
this.disable(ROTATION_ACTION_BUTTONS);
}
private get _rotateRight(): IHeaderElement {
return {
type: 'actionButton',
@ -214,10 +216,6 @@ export class ViewerHeaderService {
this.updateElements();
if (this._iqserPermissionsService.has(ROLES.files.rotatePage)) {
this.enable([HeaderElements.ROTATE_LEFT_BUTTON, HeaderElements.ROTATE_RIGHT_BUTTON]);
}
if (this._userPreferenceService.areDevFeaturesEnabled) {
this.enable([HeaderElements.LOAD_ALL_ANNOTATIONS]);
}
@ -269,6 +267,17 @@ export class ViewerHeaderService {
});
}
enableRotationButtons(): void {
if (this._iqserPermissionsService.has(ROLES.files.rotatePage)) {
this.enable(ROTATION_BUTTONS);
}
}
disableRotationButtons(): void {
this.disable(ROTATION_BUTTONS);
this.#discardRotation();
}
resetCompareButtons() {
this.disable([HeaderElements.CLOSE_COMPARE_BUTTON]);
this.enable([HeaderElements.COMPARE_BUTTON]);

View File

@ -2,6 +2,7 @@ import { CustomError, List } from '@iqser/common-ui';
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
import { HeaderElements, TextPopups } from '../../file-preview/utils/constants';
export const ROTATION_BUTTONS = [HeaderElements.ROTATE_LEFT_BUTTON, HeaderElements.ROTATE_RIGHT_BUTTON];
export const ROTATION_ACTION_BUTTONS = [HeaderElements.APPLY_ROTATION, HeaderElements.DISCARD_ROTATION];
export const TEXT_POPUPS_TO_TOGGLE = [TextPopups.ADD_REDACTION, TextPopups.ADD_RECTANGLE, TextPopups.ADD_FALSE_POSITIVE];