From 1c49306fc2636d0871b668f05346ac86dbace235 Mon Sep 17 00:00:00 2001 From: Ahmet C <cetin.ahmet@live.de> Date: Tue, 29 Jun 2021 22:52:34 +0200 Subject: [PATCH] Allow Manual and automatic Weightclass setting --- .../cloud-configuration.component.html | 7 +++- .../cloud-configuration.component.scss | 4 +++ .../cloud-configuration.component.ts | 36 +++++++++++++------ .../weight-class.interface.ts | 1 + .../shared/tag-cloud/tag-cloud.component.ts | 20 +++++------ .../shared/tag-cloud/tag-cloud.interface.ts | 1 + src/assets/i18n/creator/de.json | 3 +- src/assets/i18n/creator/en.json | 3 +- src/assets/i18n/participant/de.json | 3 +- src/assets/i18n/participant/en.json | 3 +- 10 files changed, 56 insertions(+), 25 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 0a11a0443..b8528a3de 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 @@ -157,6 +157,11 @@ <div class ="weight-class-setting-content"> <label class=" expansion-title weight-class-heading">{{'tag-cloud-config.weight-class' | translate}} {{weightClasses.indexOf(weightClass) + 1}}</label> <div class="input-row" fxLayout="column" fxLayoutGap="5px"> + <div class="input-row firstElementOfWeightClass" fxLayout="row" fxLayoutGap="5px" fxLayout.xs="column"> + <mat-slide-toggle matTooltip="{{'tag-cloud-config.manual-weight-number' | translate}}" (change)="valueChanged()" fxFlex [(ngModel)]=" weightClass.allowManualTagNumber" + [ngModelOptions]="{standalone: true}">{{'tag-cloud-config.manual-weight-number' | translate}}</mat-slide-toggle> + <mat-icon matTooltip="{{'tag-cloud-config.random-angle-note' | translate}}">help</mat-icon> + </div> <div fxLayout="row" fxLayoutGap="5px"> <mat-form-field fxFlex="100%"> <mat-label>{{'tag-cloud-config.weight-color' | translate}}</mat-label> @@ -168,7 +173,7 @@ <div fxFlex="35px" class="color-box" [style.background]="weightClass.tagColor"></div> </div> </div> - <div class="input-row" fxLayout="column" fxLayoutGap="5px" *ngIf="weightClass.actualTagNumber > 0 && !parent.dataManager.demoActive"> + <div class="input-row" fxLayout="column" fxLayoutGap="5px" *ngIf="weightClass.actualTagNumber > 0 && !parent.dataManager.demoActive && weightClass.allowManualTagNumber"> <div class="input-row" fxLayout="column" fxLayoutGap="5px"> <mat-label class="label-text" >{{'tag-cloud-config.weight-number' | translate}}</mat-label> <mat-slider [value]="weightClass.maxTagNumber" min="1" [max]="weightClass.actualTagNumber" step="1" diff --git a/src/app/components/shared/_dialogs/cloud-configuration/cloud-configuration.component.scss b/src/app/components/shared/_dialogs/cloud-configuration/cloud-configuration.component.scss index 316554c43..fbb071b52 100644 --- a/src/app/components/shared/_dialogs/cloud-configuration/cloud-configuration.component.scss +++ b/src/app/components/shared/_dialogs/cloud-configuration/cloud-configuration.component.scss @@ -237,6 +237,10 @@ mat-divider { border-top: 2px solid var(--primary); padding-top: 10px; } +.firstElementOfWeightClass{ + margin-top: 10px; + padding-bottom: 10px; +} .automatic-spelling{ padding-bottom: 30px; } 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 c0a1b088d..bdd01fdb6 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 @@ -32,61 +32,71 @@ export class CloudConfigurationComponent implements OnInit { maxTagNumber: 20, tagColor: '#8800ff', actualTagNumber: 5, - rotationAngle: 0 + rotationAngle: 0, + allowManualTagNumber: false }, { maxTagNumber: 20, tagColor: '#ff00ff', actualTagNumber: 5, rotationAngle: 0, + allowManualTagNumber: false }, { maxTagNumber: 17, tagColor: '#ffea00', actualTagNumber: 5, - rotationAngle: 0 + rotationAngle: 0, + allowManualTagNumber: false }, { maxTagNumber: 15, tagColor: '#00CC99', actualTagNumber: 5, - rotationAngle: 0 + rotationAngle: 0, + allowManualTagNumber: false }, { maxTagNumber: 12, tagColor: '#00CC66', actualTagNumber: 5, - rotationAngle: 0 + rotationAngle: 0, + allowManualTagNumber: false }, { maxTagNumber: 10, tagColor: '#0033FF', actualTagNumber: 5, - rotationAngle: 0 + rotationAngle: 0, + allowManualTagNumber: false }, { maxTagNumber: 8, tagColor: '#CC0099', actualTagNumber: 5, - rotationAngle: 0 + rotationAngle: 0, + allowManualTagNumber: false }, { maxTagNumber: 7, tagColor: '#FF3399', actualTagNumber: 5, - rotationAngle: 0 + rotationAngle: 0, + allowManualTagNumber: false }, { maxTagNumber: 6, tagColor: '#FFFF00', actualTagNumber: 5, - rotationAngle: 0 + rotationAngle: 0, + allowManualTagNumber: false }, { maxTagNumber: 5, tagColor: '#FF0000', actualTagNumber: 5, - rotationAngle: 0 + rotationAngle: 0, + allowManualTagNumber: false }, ]; MinFont:number; @@ -135,12 +145,18 @@ export class CloudConfigurationComponent implements OnInit { this.weightClasses[i].actualTagNumber = this.countPerWeight[i]; this.weightClasses[i].rotationAngle = element.rotation; this.weightClasses[i].maxTagNumber = (element.maxVisibleElements == -1 || element.maxVisibleElements == 0) ? this.weightClasses[i].actualTagNumber : element.maxVisibleElements; + this.weightClasses[i].allowManualTagNumber = element.allowManualTagNumber; }); } parseJsonToArrayWeightClasses() { this.weightClasses.forEach((element, i) => { - this.cloudParameters.cloudWeightSettings[i].maxVisibleElements = element.maxTagNumber == 0 ? -1 : element.maxTagNumber; + this.cloudParameters.cloudWeightSettings[i].allowManualTagNumber = element.allowManualTagNumber; + if(element.allowManualTagNumber == true){ + this.cloudParameters.cloudWeightSettings[i].maxVisibleElements = element.maxTagNumber == 0 ? -1 : element.maxTagNumber; + }else{ + this.cloudParameters.cloudWeightSettings[i].maxVisibleElements = -1; + } this.cloudParameters.cloudWeightSettings[i].color = element.tagColor; this.cloudParameters.cloudWeightSettings[i].rotation = element.rotationAngle; }); diff --git a/src/app/components/shared/_dialogs/cloud-configuration/weight-class.interface.ts b/src/app/components/shared/_dialogs/cloud-configuration/weight-class.interface.ts index 237959840..6cf05143b 100644 --- a/src/app/components/shared/_dialogs/cloud-configuration/weight-class.interface.ts +++ b/src/app/components/shared/_dialogs/cloud-configuration/weight-class.interface.ts @@ -3,4 +3,5 @@ export interface WeightClass { tagColor: string; actualTagNumber: number; rotationAngle: number; + allowManualTagNumber: boolean; } diff --git a/src/app/components/shared/tag-cloud/tag-cloud.component.ts b/src/app/components/shared/tag-cloud/tag-cloud.component.ts index 2e4c2dfe0..6f77a89b4 100644 --- a/src/app/components/shared/tag-cloud/tag-cloud.component.ts +++ b/src/app/components/shared/tag-cloud/tag-cloud.component.ts @@ -113,16 +113,16 @@ const getResolvedDefaultColors = (): string[] => { const getDefaultCloudParameters = (): CloudParameters => { const resDefaultColors = getResolvedDefaultColors(); const weightSettings: CloudWeightSettings = [ - {maxVisibleElements: -1, color: resDefaultColors[1], rotation: 0}, - {maxVisibleElements: -1, color: resDefaultColors[2], rotation: 0}, - {maxVisibleElements: -1, color: resDefaultColors[3], rotation: 0}, - {maxVisibleElements: -1, color: resDefaultColors[4], rotation: 0}, - {maxVisibleElements: -1, color: resDefaultColors[5], rotation: 0}, - {maxVisibleElements: -1, color: resDefaultColors[6], rotation: 0}, - {maxVisibleElements: -1, color: resDefaultColors[7], rotation: 0}, - {maxVisibleElements: -1, color: resDefaultColors[8], rotation: 0}, - {maxVisibleElements: -1, color: resDefaultColors[9], rotation: 0}, - {maxVisibleElements: -1, color: resDefaultColors[10], rotation: 0}, + {maxVisibleElements: -1, color: resDefaultColors[1], rotation: 0, allowManualTagNumber: false}, + {maxVisibleElements: -1, color: resDefaultColors[2], rotation: 0, allowManualTagNumber: false}, + {maxVisibleElements: -1, color: resDefaultColors[3], rotation: 0, allowManualTagNumber: false}, + {maxVisibleElements: -1, color: resDefaultColors[4], rotation: 0, allowManualTagNumber: false}, + {maxVisibleElements: -1, color: resDefaultColors[5], rotation: 0, allowManualTagNumber: false}, + {maxVisibleElements: -1, color: resDefaultColors[6], rotation: 0, allowManualTagNumber: false}, + {maxVisibleElements: -1, color: resDefaultColors[7], rotation: 0, allowManualTagNumber: false}, + {maxVisibleElements: -1, color: resDefaultColors[8], rotation: 0, allowManualTagNumber: false}, + {maxVisibleElements: -1, color: resDefaultColors[9], rotation: 0, allowManualTagNumber: false}, + {maxVisibleElements: -1, color: resDefaultColors[10], rotation: 0, allowManualTagNumber: false}, ]; return { fontFamily: 'Dancing Script', diff --git a/src/app/components/shared/tag-cloud/tag-cloud.interface.ts b/src/app/components/shared/tag-cloud/tag-cloud.interface.ts index 240eb3b0b..5ede58cb1 100644 --- a/src/app/components/shared/tag-cloud/tag-cloud.interface.ts +++ b/src/app/components/shared/tag-cloud/tag-cloud.interface.ts @@ -15,6 +15,7 @@ export interface CloudWeightSetting { * null indicates random rotation. */ rotation: number; + allowManualTagNumber: boolean; } export type CloudWeightSettings = [ diff --git a/src/assets/i18n/creator/de.json b/src/assets/i18n/creator/de.json index b37128502..84bc952e8 100644 --- a/src/assets/i18n/creator/de.json +++ b/src/assets/i18n/creator/de.json @@ -499,6 +499,7 @@ "font-family-tooltip": "Schriftart auswählen", "bold-notation-tooltip": "Schrift fett setzen", "font-style-bold" : "Fett", - "font-family":"Schriftart" + "font-family":"Schriftart", + "manual-weight-number": "Manuelle Anzahl" } } diff --git a/src/assets/i18n/creator/en.json b/src/assets/i18n/creator/en.json index cd1ac29e3..1d560ea1b 100644 --- a/src/assets/i18n/creator/en.json +++ b/src/assets/i18n/creator/en.json @@ -499,6 +499,7 @@ "bold-notation-tooltip": "Select font-thickness bold", "font-style-bold" : "Bold", "font-style-italic": "Italic", - "font-family":"Font Family" + "font-family":"Font Family", + "manual-weight-number": "Manual amount" } } diff --git a/src/assets/i18n/participant/de.json b/src/assets/i18n/participant/de.json index f93a0d400..f06ac5cc5 100644 --- a/src/assets/i18n/participant/de.json +++ b/src/assets/i18n/participant/de.json @@ -367,6 +367,7 @@ "font-family-tooltip": "Schrift auswählen", "bold-notation-tooltip": "Schrift fett setzen", "font-style-bold" : "Fett", - "font-family":"Schriftart" + "font-family":"Schriftart", + "manual-weight-number": "Manuelle Anzahl" } } diff --git a/src/assets/i18n/participant/en.json b/src/assets/i18n/participant/en.json index 8efe1c76f..75a29eefd 100644 --- a/src/assets/i18n/participant/en.json +++ b/src/assets/i18n/participant/en.json @@ -374,6 +374,7 @@ "bold-notation-tooltip": "Select font-thickness bold", "font-style-bold" : "Bold", "font-style-italic": "Italic", - "font-family":"Font Family" + "font-family":"Font Family", + "manual-weight-number": "Manual amount" } } -- GitLab