UNPKG

ng2-tree-hackaday

Version:

angular2 component for visualizing data that can be naturally represented as a tree

29 lines (22 loc) 690 B
import { Tree } from '../tree'; import { ElementRef } from '@angular/core'; export class CapturedNode { public constructor(private anElement: ElementRef, private aTree: Tree) { } public canBeDroppedAt(element: ElementRef): boolean { return !this.sameAs(element) && !this.contains(element); } public contains(other: ElementRef): boolean { return this.element.nativeElement.contains(other.nativeElement); } public sameAs(other: ElementRef): boolean { return this.element === other; } public get element(): ElementRef { return this.anElement; } public get tree(): Tree { return this.aTree; } }