Skip to content
Snippets Groups Projects
Commit de3be1d8 authored by jojohoch's avatar jojohoch
Browse files

Detect whether elements are displayed in the player or in the editor

parent 11216e44
No related branches found
No related tags found
No related merge requests found
import {
AfterViewInit,
Directive, ElementRef
} from '@angular/core';
import { UIElement } from './models/uI-element';
@Directive()
export abstract class ElementComponent {
export abstract class ElementComponent implements AfterViewInit {
abstract elementModel: UIElement;
project!: 'player' | 'editor';
constructor(private elementRef: ElementRef) {}
get domElement(): Element {
return this.elementRef.nativeElement;
}
ngAfterViewInit(): void {
this.project = this.elementRef.nativeElement.closest('app-element-container') ? 'player' : 'editor';
}
}
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