Skip to content
Snippets Groups Projects
Commit 29fc040b authored by rhenck's avatar rhenck
Browse files

[editor] Cleanup code

- Remove unused variable
- Add typing
parent 596a70c1
No related branches found
No related tags found
No related merge requests found
Pipeline #42347 passed
...@@ -18,7 +18,6 @@ import { SelectionService } from '../../../services/selection.service'; ...@@ -18,7 +18,6 @@ import { SelectionService } from '../../../services/selection.service';
@Directive() @Directive()
export abstract class CanvasElementOverlay implements OnInit, OnDestroy { export abstract class CanvasElementOverlay implements OnInit, OnDestroy {
@Input() element!: UIElement; @Input() element!: UIElement;
@Input() viewMode: boolean = false;
@Output() elementSelected = new EventEmitter(); @Output() elementSelected = new EventEmitter();
@ViewChild('elementContainer', { read: ViewContainerRef, static: true }) private elementContainer!: ViewContainerRef; @ViewChild('elementContainer', { read: ViewContainerRef, static: true }) private elementContainer!: ViewContainerRef;
isSelected = false; isSelected = false;
......
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { BehaviorSubject, Observable } from 'rxjs'; import { BehaviorSubject, Observable } from 'rxjs';
import { UIElement } from 'common/models/elements/element'; 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({ @Injectable({
providedIn: 'root' providedIn: 'root'
...@@ -9,7 +13,7 @@ export class SelectionService { ...@@ -9,7 +13,7 @@ export class SelectionService {
selectedPageIndex: number = 0; selectedPageIndex: number = 0;
selectedPageSectionIndex: number = 0; selectedPageSectionIndex: number = 0;
private _selectedElements!: BehaviorSubject<UIElement[]>; private _selectedElements!: BehaviorSubject<UIElement[]>;
selectedElementComponents: any[] = []; selectedElementComponents: (CanvasElementOverlay | CompoundChildOverlayComponent)[] = [];
selectedCompoundChild: { element: UIElement, nativeElement: HTMLElement } | null = null; selectedCompoundChild: { element: UIElement, nativeElement: HTMLElement } | null = null;
constructor() { constructor() {
...@@ -24,7 +28,7 @@ export class SelectionService { ...@@ -24,7 +28,7 @@ export class SelectionService {
return this._selectedElements.value; return this._selectedElements.value;
} }
selectElement(event: { elementComponent: any; multiSelect: boolean }): void { selectElement(event: { elementComponent: CanvasElementOverlay | CompoundChildOverlayComponent; multiSelect: boolean }): void {
if (!event.multiSelect) { if (!event.multiSelect) {
this.clearElementSelection(); this.clearElementSelection();
} }
...@@ -34,7 +38,7 @@ export class SelectionService { ...@@ -34,7 +38,7 @@ export class SelectionService {
} }
clearElementSelection(): void { clearElementSelection(): void {
this.selectedElementComponents.forEach((overlayComponent: any) => { this.selectedElementComponents.forEach((overlayComponent: CanvasElementOverlay | CompoundChildOverlayComponent) => {
overlayComponent.setSelected(false); overlayComponent.setSelected(false);
}); });
this.selectedElementComponents = []; this.selectedElementComponents = [];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment