From e2b2f5f20c6278314077e9dbe0973a562218daf7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lukas=20Mau=C3=9F?= <lukas.mauss@mni.thm.de>
Date: Thu, 9 May 2019 14:20:44 +0200
Subject: [PATCH] Cleanup comment presentation

---
 .../present-comment.component.html             |  4 ++--
 .../present-comment.component.ts               |  6 ++----
 .../shared/comment/comment.component.ts        | 18 +++++++++++++++---
 3 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/src/app/components/shared/_dialogs/present-comment/present-comment.component.html b/src/app/components/shared/_dialogs/present-comment/present-comment.component.html
index 2e56acb91..e24779e17 100644
--- a/src/app/components/shared/_dialogs/present-comment/present-comment.component.html
+++ b/src/app/components/shared/_dialogs/present-comment/present-comment.component.html
@@ -1,5 +1,5 @@
-<mat-slider min="2.1" max="6" step="0.2" value="1.2" thumbLabel tickInterval="auto"
-            [(ngModel)]="sliderValue" (change)="updateFontSize()" id="slider"></mat-slider>
+<mat-slider min="1" max="2" step="0.1" thumbLabel tickInterval="auto"
+            (input)="updateFontSize($event)" id="slider"></mat-slider>
 <button id="exitButton" mat-raised-button color="warn" (click)="onCloseClick()">
   <mat-icon >exit_to_app</mat-icon>
 </button>
diff --git a/src/app/components/shared/_dialogs/present-comment/present-comment.component.ts b/src/app/components/shared/_dialogs/present-comment/present-comment.component.ts
index c03c846cc..db98ecce3 100644
--- a/src/app/components/shared/_dialogs/present-comment/present-comment.component.ts
+++ b/src/app/components/shared/_dialogs/present-comment/present-comment.component.ts
@@ -9,7 +9,6 @@ import { TranslateService } from '@ngx-translate/core';
 })
 export class PresentCommentComponent implements OnInit {
   public body: string;
-  sliderValue = 0;
 
   constructor(
     public dialogRef: MatDialogRef<PresentCommentComponent>,
@@ -25,8 +24,7 @@ export class PresentCommentComponent implements OnInit {
     this.dialogRef.close('close');
   }
 
-  private updateFontSize(): void {
-     console.log(this.sliderValue);
-     document.getElementById('comment').style.fontSize = this.sliderValue + 'em';
+  private updateFontSize(event: any): void {
+     document.getElementById('comment').style.fontSize = (event.value * 2.5) + 'em';
   }
 }
diff --git a/src/app/components/shared/comment/comment.component.ts b/src/app/components/shared/comment/comment.component.ts
index ea3a50f65..64098002e 100644
--- a/src/app/components/shared/comment/comment.component.ts
+++ b/src/app/components/shared/comment/comment.component.ts
@@ -110,7 +110,20 @@ export class CommentComponent implements OnInit {
     });
   }
 
+  goToFullScreen(element: Element): void {
+    if (element.requestFullscreen) {
+      element.requestFullscreen();
+    }
+  }
+
+  exitFullScreen(): void {
+    if (document.exitFullscreen) {
+      document.exitFullscreen();
+    }
+  }
+
   openPresentDialog(comment: Comment): void {
+    this.goToFullScreen(document.documentElement);
     if (this.isStudent === false) {
       this.wsCommentService.highlight(comment);
     }
@@ -128,9 +141,8 @@ export class CommentComponent implements OnInit {
     dialogRef.afterClosed()
       .subscribe(result => {
         this.wsCommentService.lowlight(comment);
-        if (result === 'close') {
-          return;
-        }
+        this.exitFullScreen();
+
       });
   }
 }
-- 
GitLab