From 18c7df52ca49fbfea7b77943fd6f5dd48cb72e5f Mon Sep 17 00:00:00 2001 From: Dan Percic Date: Mon, 7 Mar 2022 11:23:33 +0200 Subject: [PATCH] fix page rotation discard --- .../components/pdf-viewer/pdf-viewer.component.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/pdf-viewer/pdf-viewer.component.ts b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/pdf-viewer/pdf-viewer.component.ts index 650c363fe..be1b75513 100644 --- a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/pdf-viewer/pdf-viewer.component.ts +++ b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/pdf-viewer/pdf-viewer.component.ts @@ -396,8 +396,8 @@ export class PdfViewerComponent extends AutoUnsubscribe implements OnInit, OnCha cursor: pointer; margin: 0 12px; `; - paragraph.addEventListener('click', () => { - this._pageRotationService.applyRotation(); + paragraph.addEventListener('click', async () => { + await this._pageRotationService.applyRotation(); this._showRotationConfirmationButtons(); }); return paragraph; @@ -417,6 +417,14 @@ export class PdfViewerComponent extends AutoUnsubscribe implements OnInit, OnCha opacity: 0.7; `; paragraph.addEventListener('click', () => { + const rotations = this._pageRotationService.rotations$.value; + const oneRotationDegree = 90; + for (const page of Object.keys(rotations)) { + const times = rotations[page] / oneRotationDegree; + for (let i = 1; i <= times; i++) { + this.documentViewer.rotateCounterClockwise(Number(page)); + } + } this._pageRotationService.clearRotations(); this._showRotationConfirmationButtons(); });