From 4cad79809dfc61b26e2c78a1018f0ac4ec53a682 Mon Sep 17 00:00:00 2001
From: Tom Frederik Leimbrock <tom.leimbrock@mni.thm.de>
Date: Sat, 19 Jun 2021 12:50:15 +0200
Subject: [PATCH] load the font style correctly

This commit ensures that when you open the tag
cloud settings, the bold and italic font sliders
are enabled according to the actual setting.

Closes #114
---
 .../cloud-configuration.component.html                 |  6 +++---
 .../cloud-configuration.component.ts                   | 10 +++++++++-
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/app/components/shared/_dialogs/cloud-configuration/cloud-configuration.component.html b/src/app/components/shared/_dialogs/cloud-configuration/cloud-configuration.component.html
index ee19adcd5..793df0cb5 100644
--- a/src/app/components/shared/_dialogs/cloud-configuration/cloud-configuration.component.html
+++ b/src/app/components/shared/_dialogs/cloud-configuration/cloud-configuration.component.html
@@ -81,9 +81,9 @@
           </mat-form-field>
         </div>
         <div class="input-row special-settings automatic-spelling" fxLayout="row" fxLayoutGap="5px" fxLayout.xs="column">
-          <mat-radio-group matTooltip="{{'tag-cloud-config.notation-tooltip' | translate}}" aria-label="Notation:"> 
-            <div><mat-slide-toggle value="italic" (change)="italicChecked($event)"[ngModelOptions]="{standalone: true}">{{'tag-cloud-config.font-style-italic' | translate}}</mat-slide-toggle> </div>
-            <div><mat-slide-toggle value="bold" (change)="boldChecked($event)" [ngModelOptions]="{standalone: true}">{{'tag-cloud-config.font-style-bold' | translate}}</mat-slide-toggle> </div>
+          <mat-radio-group matTooltip="{{'tag-cloud-config.notation-tooltip' | translate}}" aria-label="Notation:">
+            <div><mat-slide-toggle [checked]="checkItalic()" (change)="italicChecked($event)"[ngModelOptions]="{standalone: true}">{{'tag-cloud-config.font-style-italic' | translate}}</mat-slide-toggle> </div>
+            <div><mat-slide-toggle [checked]="checkBold()" (change)="boldChecked($event)" [ngModelOptions]="{standalone: true}">{{'tag-cloud-config.font-style-bold' | translate}}</mat-slide-toggle> </div>
           </mat-radio-group>
         </div>
         <div class="input-row" fxLayout="column" fxLayoutGap="5px">
diff --git a/src/app/components/shared/_dialogs/cloud-configuration/cloud-configuration.component.ts b/src/app/components/shared/_dialogs/cloud-configuration/cloud-configuration.component.ts
index 73867bbbb..763f3760a 100644
--- a/src/app/components/shared/_dialogs/cloud-configuration/cloud-configuration.component.ts
+++ b/src/app/components/shared/_dialogs/cloud-configuration/cloud-configuration.component.ts
@@ -157,7 +157,7 @@ export class CloudConfigurationComponent implements OnInit {
     this.parent.tagCloudDataManager.demoActive = false;
     this.parent.setCloudParameters(this.cloudParameters);
     this.parent.configurationOpen = false;
-   this.setStep(0)
+   this.setStep(0);
 
   }
 
@@ -207,4 +207,12 @@ export class CloudConfigurationComponent implements OnInit {
     event.checked == true ? this.cloudParameters.fontWeight = "bold" : this.cloudParameters.fontWeight = "normal";
     this.valueChanged();
   }
+
+  checkItalic() {
+    return this.cloudParameters.fontStyle === 'italic';
+  }
+
+  checkBold() {
+    return this.cloudParameters.fontWeight === 'bold';
+  }
 }
-- 
GitLab