import { Directive , ElementRef , Inject } from '@angular/core' ; import { DOCUMENT } from '@angular/common' ; import { TrackAdapter } from './track' ; import { NgScrollbarBase } from '../../ng-scrollbar-base' ; @ Directive ( { selector : '[scrollbarTrackX]' } ) export class TrackXDirective extends TrackAdapter { get pageProperty ( ) : string { return 'pageX' ; } get offset ( ) : number { return this . clientRect . left ; } get size ( ) : number { return this . trackElement . clientWidth ; } constructor ( protected cmp , trackElement , @ Inject ( DOCUMENT ) protected document ) { super ( cmp , trackElement . nativeElement , document ) ; } protected mapToScrollToOption ( value ) { return { left : value } ; } } @ Directive ( { selector : '[scrollbarTrackY]' } ) export class TrackYDirective extends TrackAdapter { get pageProperty ( ) : string { return 'pageY' ; } get offset ( ) : number { return this . clientRect . top ; } get size ( ) : number { return this . trackElement . clientHeight ; } constructor ( protected cmp , trackElement , @ Inject ( DOCUMENT ) protected document ) { super ( cmp , trackElement . nativeElement , document ) ; } protected mapToScrollToOption ( value ) { return { top : value } ; } }