From b0780ef1ca5f04023f60a5a7f3e3facf7f20692f Mon Sep 17 00:00:00 2001
From: rhenck <richard.henck@iqb.hu-berlin.de>
Date: Tue, 28 May 2024 15:12:58 +0200
Subject: [PATCH] [editor] Rename selectedSectionIndex

---
 .../app/components/canvas/canvas.component.html    | 14 +++++++-------
 .../src/app/components/canvas/canvas.component.ts  |  2 +-
 .../components/canvas/section-menu.component.ts    |  8 ++++----
 .../input-groups/dimension-field-set.component.ts  |  2 +-
 .../input-groups/position-field-set.component.ts   |  2 +-
 .../editor/src/app/services/selection.service.ts   |  4 ++--
 6 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/projects/editor/src/app/components/canvas/canvas.component.html b/projects/editor/src/app/components/canvas/canvas.component.html
index a3cc4691f..83918eca7 100644
--- a/projects/editor/src/app/components/canvas/canvas.component.html
+++ b/projects/editor/src/app/components/canvas/canvas.component.html
@@ -5,7 +5,7 @@
        [style.background-color]="page.backgroundColor">
     <div cdkDropListGroup>
       <div *ngFor="let section of page.sections; let i = index" [style.position]="'relative'">
-        <aspect-section-menu [class.hidden]="selectionService.selectedPageSectionIndex !== i"
+        <aspect-section-menu [class.hidden]="selectionService.selectedSectionIndex !== i"
                              class="section-menu fx-column-start-stretch"
                              [style.left.px]="-45" [style.z-index]="1" [style.position]="'absolute'"
                              [section]="section" [sectionIndex]="i"
@@ -20,23 +20,23 @@
                                #sectionComponent
                                class="section drop-list" id="section-{{i}}"
                                [section]="section"
-                               [isSelected]="selectionService.selectedPageSectionIndex === i"
-                               (elementSelected)="selectionService.selectedPageSectionIndex = i"
+                               [isSelected]="selectionService.selectedSectionIndex === i"
+                               (elementSelected)="selectionService.selectedSectionIndex = i"
                                cdkDropList cdkDropListSortingDisabled
                                [cdkDropListData]="{ sectionIndex: i }"
                                (cdkDropListDropped)="elementDropped($event)"
-                               (click)="selectionService.selectedPageSectionIndex = i">
+                               (click)="selectionService.selectedSectionIndex = i">
         </aspect-section-static>
         <aspect-section-dynamic *ngIf="section.dynamicPositioning"
                                 #sectionComponent
                                 class="section drop-list"
                                 [section]="section" [sectionIndex]="i"
-                                [isSelected]="selectionService.selectedPageSectionIndex === i"
-                                (elementSelected)="selectionService.selectedPageSectionIndex = i"
+                                [isSelected]="selectionService.selectedSectionIndex === i"
+                                (elementSelected)="selectionService.selectedSectionIndex = i"
                                 (transferElement)="moveElementsBetweenSections(selectionService.getSelectedElements(),
                                                            $event.previousSectionIndex,
                                                            $event.newSectionIndex)"
-                                (click)="selectionService.selectedPageSectionIndex = i">
+                                (click)="selectionService.selectedSectionIndex = i">
         </aspect-section-dynamic>
       </div>
     </div>
diff --git a/projects/editor/src/app/components/canvas/canvas.component.ts b/projects/editor/src/app/components/canvas/canvas.component.ts
index a2f687ebb..6bdfe2237 100644
--- a/projects/editor/src/app/components/canvas/canvas.component.ts
+++ b/projects/editor/src/app/components/canvas/canvas.component.ts
@@ -92,7 +92,7 @@ export class CanvasComponent {
 
   addSection(): void {
     this.sectionService.addSection(this.page);
-    this.selectionService.selectedPageSectionIndex = this.page.sections.length - 1;
+    this.selectionService.selectedSectionIndex = this.page.sections.length - 1;
   }
 
   selectElementOverlay(element: UIElement): void {
diff --git a/projects/editor/src/app/components/canvas/section-menu.component.ts b/projects/editor/src/app/components/canvas/section-menu.component.ts
index 3f84e8864..4a904ea5c 100644
--- a/projects/editor/src/app/components/canvas/section-menu.component.ts
+++ b/projects/editor/src/app/components/canvas/section-menu.component.ts
@@ -212,8 +212,8 @@ export class SectionMenuComponent implements OnDestroy {
           if (result) {
             ReferenceManager.deleteReferences(refs);
             this.sectionService.deleteSection(this.selectionService.selectedPageIndex, this.sectionIndex);
-            this.selectionService.selectedPageSectionIndex =
-              Math.max(0, this.selectionService.selectedPageSectionIndex - 1);
+            this.selectionService.selectedSectionIndex =
+              Math.max(0, this.selectionService.selectedSectionIndex - 1);
           } else {
             this.messageService.showReferencePanel(refs);
           }
@@ -224,8 +224,8 @@ export class SectionMenuComponent implements OnDestroy {
         .subscribe((result: boolean) => {
           if (result) {
             this.sectionService.deleteSection(this.selectionService.selectedPageIndex, this.sectionIndex);
-            this.selectionService.selectedPageSectionIndex =
-              Math.max(0, this.selectionService.selectedPageSectionIndex - 1);
+            this.selectionService.selectedSectionIndex =
+              Math.max(0, this.selectionService.selectedSectionIndex - 1);
           }
         });
     }
diff --git a/projects/editor/src/app/components/properties-panel/position-properties-tab/input-groups/dimension-field-set.component.ts b/projects/editor/src/app/components/properties-panel/position-properties-tab/input-groups/dimension-field-set.component.ts
index 69889b696..63736bce2 100644
--- a/projects/editor/src/app/components/properties-panel/position-properties-tab/input-groups/dimension-field-set.component.ts
+++ b/projects/editor/src/app/components/properties-panel/position-properties-tab/input-groups/dimension-field-set.component.ts
@@ -10,7 +10,7 @@ import { ElementService } from 'editor/src/app/services/unit-services/element.se
     <fieldset>
       <legend>Dimensionen</legend>
       <ng-container *ngIf="unitService.unit.pages[selectionService.selectedPageIndex]
-                    .sections[selectionService.selectedPageSectionIndex].dynamicPositioning ||
+                    .sections[selectionService.selectedSectionIndex].dynamicPositioning ||
                     selectionService.isClozeChildSelected;
                     else elseBlock">
         <mat-checkbox #fixedWidth [checked]="$any(dimensions.isWidthFixed)"
diff --git a/projects/editor/src/app/components/properties-panel/position-properties-tab/input-groups/position-field-set.component.ts b/projects/editor/src/app/components/properties-panel/position-properties-tab/input-groups/position-field-set.component.ts
index 40fc4153d..dce82e0d4 100644
--- a/projects/editor/src/app/components/properties-panel/position-properties-tab/input-groups/position-field-set.component.ts
+++ b/projects/editor/src/app/components/properties-panel/position-properties-tab/input-groups/position-field-set.component.ts
@@ -13,7 +13,7 @@ import { UnitService } from 'editor/src/app/services/unit-services/unit.service'
       <legend>Position</legend>
       <div *ngIf="!unitService.unit
                     .pages[selectionService.selectedPageIndex]
-                    .sections[selectionService.selectedPageSectionIndex]
+                    .sections[selectionService.selectedSectionIndex]
                     .dynamicPositioning;
                     else elseBlock"
            class="flex-row">
diff --git a/projects/editor/src/app/services/selection.service.ts b/projects/editor/src/app/services/selection.service.ts
index 77e6d6566..3fa6afc0d 100644
--- a/projects/editor/src/app/services/selection.service.ts
+++ b/projects/editor/src/app/services/selection.service.ts
@@ -11,7 +11,7 @@ import {
 })
 export class SelectionService {
   selectedPageIndex: number = 0;
-  selectedPageSectionIndex: number = 0;
+  selectedSectionIndex: number = 0;
   private _selectedElements!: BehaviorSubject<UIElement[]>;
   selectedElementComponents: (CanvasElementOverlay | ClozeChildOverlay)[] = [];
   isClozeChildSelected: boolean = false;
@@ -49,7 +49,7 @@ export class SelectionService {
   selectPage(index: number) {
     this.clearElementSelection();
     this.selectedPageIndex = index;
-    this.selectedPageSectionIndex = 0;
+    this.selectedSectionIndex = 0;
   }
 
   selectPreviousPage() {
-- 
GitLab