From 3d211dc0d40ed635d9346969e3320ccff6baabce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adina=20=C8=9Aeudan?= Date: Wed, 13 Jan 2021 15:21:38 +0200 Subject: [PATCH] Fixed diagonal watermark --- .../watermark-screen/watermark-screen.component.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/red-ui/src/app/screens/admin/watermark-screen/watermark-screen.component.ts b/apps/red-ui/src/app/screens/admin/watermark-screen/watermark-screen.component.ts index 09b4674e3..f238b111e 100644 --- a/apps/red-ui/src/app/screens/admin/watermark-screen/watermark-screen.component.ts +++ b/apps/red-ui/src/app/screens/admin/watermark-screen/watermark-screen.component.ts @@ -18,7 +18,7 @@ export const DEFAULT_WATERMARK: WatermarkModel = { opacity: 70, fontSize: 11, fontType: 'sans-serif', - orientation: 'DIAGONAL' + orientation: WatermarkModel.WatermarkOrientationEnum.DIAGONAL }; @Component({ @@ -145,12 +145,12 @@ export class WatermarkScreenComponent implements OnInit { const lines = text.split('\n'); const fontSize = this.configForm.get('fontSize').value; const fontType = this.configForm.get('fontType').value; - const orientation = this.configForm.get('orientation').value; + const orientation: WatermarkModel.WatermarkOrientationEnum = this.configForm.get('orientation').value; const lineHeight = fontSize + 4; const opacity = this.configForm.get('opacity').value; const color = this.configForm.get('hexColor').value; - if (orientation === 'ROTATE_LEFT_45_DEG') { + if (orientation === WatermarkModel.WatermarkOrientationEnum.DIAGONAL) { this._instance.docViewer.setWatermark({ diagonal: { text, @@ -169,10 +169,10 @@ export class WatermarkScreenComponent implements OnInit { for (let idx = 0; idx < lines.length; ++idx) { ctx.save(); - if (orientation === 'HORIZONTAL') { + if (orientation === WatermarkModel.WatermarkOrientationEnum.HORIZONTAL) { ctx.translate(pageWidth / 2, pageHeight / 2 - (lineHeight * lines.length) / 2); } - if (orientation === 'VERTICAL') { + if (orientation === WatermarkModel.WatermarkOrientationEnum.VERTICAL) { ctx.translate(pageWidth / 2, 0); ctx.rotate(-Math.PI / 2); ctx.translate(-pageHeight / 2, -(lineHeight * lines.length) / 2);