From 29fc040b917f0e7ed89663f042f2ce1554f922cd Mon Sep 17 00:00:00 2001
From: rhenck <richard.henck@iqb.hu-berlin.de>
Date: Sun, 20 Nov 2022 00:37:04 +0100
Subject: [PATCH] [editor] Cleanup code

- Remove unused variable
- Add typing
---
 .../canvas/overlays/canvas-element-overlay.ts          |  1 -
 projects/editor/src/app/services/selection.service.ts  | 10 +++++++---
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/projects/editor/src/app/components/canvas/overlays/canvas-element-overlay.ts b/projects/editor/src/app/components/canvas/overlays/canvas-element-overlay.ts
index 60d6eeb66..72de29b33 100644
--- a/projects/editor/src/app/components/canvas/overlays/canvas-element-overlay.ts
+++ b/projects/editor/src/app/components/canvas/overlays/canvas-element-overlay.ts
@@ -18,7 +18,6 @@ import { SelectionService } from '../../../services/selection.service';
 @Directive()
 export abstract class CanvasElementOverlay implements OnInit, OnDestroy {
   @Input() element!: UIElement;
-  @Input() viewMode: boolean = false;
   @Output() elementSelected = new EventEmitter();
   @ViewChild('elementContainer', { read: ViewContainerRef, static: true }) private elementContainer!: ViewContainerRef;
   isSelected = false;
diff --git a/projects/editor/src/app/services/selection.service.ts b/projects/editor/src/app/services/selection.service.ts
index 54a8d9268..700177386 100644
--- a/projects/editor/src/app/services/selection.service.ts
+++ b/projects/editor/src/app/services/selection.service.ts
@@ -1,6 +1,10 @@
 import { Injectable } from '@angular/core';
 import { BehaviorSubject, Observable } from 'rxjs';
 import { UIElement } from 'common/models/elements/element';
+import { CanvasElementOverlay } from 'editor/src/app/components/canvas/overlays/canvas-element-overlay';
+import {
+  CompoundChildOverlayComponent
+} from 'common/components/compound-elements/cloze/compound-child-overlay.component';
 
 @Injectable({
   providedIn: 'root'
@@ -9,7 +13,7 @@ export class SelectionService {
   selectedPageIndex: number = 0;
   selectedPageSectionIndex: number = 0;
   private _selectedElements!: BehaviorSubject<UIElement[]>;
-  selectedElementComponents: any[] = [];
+  selectedElementComponents: (CanvasElementOverlay | CompoundChildOverlayComponent)[] = [];
   selectedCompoundChild: { element: UIElement, nativeElement: HTMLElement } | null = null;
 
   constructor() {
@@ -24,7 +28,7 @@ export class SelectionService {
     return this._selectedElements.value;
   }
 
-  selectElement(event: { elementComponent: any; multiSelect: boolean }): void {
+  selectElement(event: { elementComponent: CanvasElementOverlay | CompoundChildOverlayComponent; multiSelect: boolean }): void {
     if (!event.multiSelect) {
       this.clearElementSelection();
     }
@@ -34,7 +38,7 @@ export class SelectionService {
   }
 
   clearElementSelection(): void {
-    this.selectedElementComponents.forEach((overlayComponent: any) => {
+    this.selectedElementComponents.forEach((overlayComponent: CanvasElementOverlay | CompoundChildOverlayComponent) => {
       overlayComponent.setSelected(false);
     });
     this.selectedElementComponents = [];
-- 
GitLab