Skip to content
Snippets Groups Projects
Commit 920cbb3a authored by rhenck's avatar rhenck
Browse files

Revert "[editor] Change element selection to also select the underlying section"

This reverts commit c71cf1a2.
parent b5f468ea
No related branches found
No related tags found
No related merge requests found
......@@ -20,7 +20,6 @@
<app-section-static *ngIf="!section.dynamicPositioning"
class="section drop-list" id="section-{{i}}"
[section]="section"
[sectionIndex]="i"
[isSelected]="selectionService.selectedPageSectionIndex === i"
cdkDropList cdkDropListSortingDisabled
[cdkDropListData]="{ sectionIndex: i }"
......
import {
Directive, Input,
ComponentFactoryResolver, ComponentRef,
ViewChild, ViewContainerRef, OnInit, OnDestroy, ChangeDetectorRef, Output, EventEmitter
ViewChild, ViewContainerRef, OnInit, OnDestroy, ChangeDetectorRef
} from '@angular/core';
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
......@@ -19,7 +19,6 @@ import { ClozeElement } from '../../../../../../../../common/models/compound-ele
export abstract class CanvasElementOverlay implements OnInit, OnDestroy {
@Input() element!: UIElement;
@Input() viewMode: boolean = false;
@Output() elementSelected = new EventEmitter<any>();
@ViewChild('elementContainer', { read: ViewContainerRef, static: true }) private elementContainer!: ViewContainerRef;
isSelected = false;
protected childComponent!: ComponentRef<ElementComponent | CompoundElementComponent>;
......@@ -64,9 +63,9 @@ export abstract class CanvasElementOverlay implements OnInit, OnDestroy {
selectElement(multiSelect: boolean = false): void {
if (multiSelect) {
this.elementSelected.emit({ componentElement: this, multiSelect: true });
this.selectionService.selectElement({ componentElement: this, multiSelect: true });
} else {
this.elementSelected.emit({ componentElement: this, multiSelect: false });
this.selectionService.selectElement({ componentElement: this, multiSelect: false });
}
}
......
......@@ -6,7 +6,6 @@ import { DragItemData, DropListData } from './canvas.component';
import { UnitService } from '../../../../services/unit.service';
import { Section } from '../../../../../../../common/models/section';
import { UIElementType } from '../../../../../../../common/models/uI-element';
import { SelectionService } from '../../../../services/selection.service';
@Component({
selector: 'app-section-dynamic',
......@@ -53,8 +52,6 @@ import { SelectionService } from '../../../../services/selection.service';
cdkDropList cdkDropListSortingDisabled
[cdkDropListData]="{ sectionIndex: sectionIndex }"
[cdkDropListConnectedTo]="dropListList"
(elementSelected)="selectionService.selectElement($event);
selectionService.selectedPageSectionIndex = sectionIndex"
(resize)="resizeOverlay($event)"
[style.position]="'relative'"
[style.pointer-events]="dragging ? 'none' : 'auto'">
......@@ -74,7 +71,7 @@ export class SectionDynamicComponent {
dragging = false;
constructor(public unitService: UnitService, public selectionService: SelectionService) { }
constructor(public unitService: UnitService) { }
drop(event: CdkDragDrop<DropListData>): void {
const dragItemData: DragItemData = event.item.data;
......
......@@ -4,7 +4,6 @@ import {
import { UnitService } from '../../../../services/unit.service';
import { Section } from '../../../../../../../common/models/section';
import { UIElementType } from '../../../../../../../common/models/uI-element';
import { SelectionService } from '../../../../services/selection.service';
@Component({
selector: 'app-section-static',
......@@ -17,9 +16,7 @@ import { SelectionService } from '../../../../services/selection.service';
(dragover)="$event.preventDefault()" (drop)="newElementDropped($event)">
<app-static-canvas-overlay
*ngFor="let element of section.elements"
[element]="$any(element)"
(elementSelected)="selectionService.selectElement($event);
selectionService.selectedPageSectionIndex = sectionIndex">
[element]="$any(element)">
</app-static-canvas-overlay>
</div>
`,
......@@ -29,11 +26,10 @@ import { SelectionService } from '../../../../services/selection.service';
})
export class SectionStaticComponent {
@Input() section!: Section;
@Input() sectionIndex!: number;
@Input() isSelected!: boolean;
@ViewChild('sectionElement') sectionElement!: ElementRef;
constructor(public unitService: UnitService, public selectionService: SelectionService) { }
constructor(public unitService: UnitService) { }
newElementDropped(event: DragEvent): void {
event.preventDefault();
......
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