import { ElementRef , Injectable } from '@angular/core' ; import { Subject } from 'rxjs/Subject' ; import { CapturedNode } from './captured-node' ; import { NodeDraggableEvent } from './draggable.events' ; @ Injectable ( ) export class NodeDraggableService { public draggableNodeEvents$ : Subject < NodeDraggableEvent > = new Subject < NodeDraggableEvent > ( ) ; private capturedNode : CapturedNode ; public fireNodeDragged ( captured , target ) { if ( ! captured . tree || captured . tree . isStatic ( ) ) { return ; } this . draggableNodeEvents$ . next ( new NodeDraggableEvent ( captured , target ) ) ; } public captureNode ( node ) { this . capturedNode = node ; } public getCapturedNode ( ) { return this . capturedNode ; } public releaseCapturedNode ( ) { this . capturedNode = null ; } }