@@ -11,19 +11,19 @@ export class HighLight implements OnInit, OnDestroy {
1111
1212 constructor ( el : ElementRef ) {
1313 this . _el = el . nativeElement ;
14- this . _highlight = ( ) => { this . _el . setProperty ( 'opacity' , 0.5 ) } ;
15- this . _unhighlight = ( ) => { this . _el . setProperty ( 'opacity' , 1 ) } ;
14+ this . _highlight = ( ) => { this . _el . children [ 0 ] . setProperty ( 'opacity' , 0.5 ) } ;
15+ this . _unhighlight = ( ) => { this . _el . children [ 0 ] . setProperty ( 'opacity' , 1 ) } ;
1616 }
1717
1818 ngOnInit ( ) {
19- this . _el . addEventListener ( 'tapstart' , this . _highlight ) ;
20- this . _el . addEventListener ( 'tapcancel' , this . _unhighlight ) ;
21- this . _el . addEventListener ( 'tap' , this . _unhighlight ) ;
19+ this . _el . children [ 0 ] . addEventListener ( 'tapstart' , this . _highlight ) ;
20+ this . _el . children [ 0 ] . addEventListener ( 'tapcancel' , this . _unhighlight ) ;
21+ this . _el . children [ 0 ] . addEventListener ( 'tap' , this . _unhighlight ) ;
2222 }
2323 ngOnDestroy ( ) {
24- this . _el . removeEventListener ( 'tapstart' , this . _highlight ) ;
25- this . _el . removeEventListener ( 'tapcancel' , this . _unhighlight ) ;
26- this . _el . removeEventListener ( 'tap' , this . _unhighlight ) ;
24+ this . _el . children [ 0 ] . removeEventListener ( 'tapstart' , this . _highlight ) ;
25+ this . _el . children [ 0 ] . removeEventListener ( 'tapcancel' , this . _unhighlight ) ;
26+ this . _el . children [ 0 ] . removeEventListener ( 'tap' , this . _unhighlight ) ;
2727 }
2828}
2929
@@ -39,24 +39,26 @@ export class NativeFeedback implements OnInit, OnDestroy {
3939 constructor ( el : ElementRef ) {
4040 this . _el = el . nativeElement ;
4141 this . _start = ( event : any ) => {
42- this . _el . dispatchCommand ( 'hotspotUpdate' , [ event . srcEvent . clientX || 0 , event . srcEvent . clientY || 0 ] ) ;
43- this . _el . dispatchCommand ( 'setPressed' , [ true ] ) ;
42+ this . _el . children [ 0 ] . dispatchCommand ( 'hotspotUpdate' , [ event . srcEvent . pageX || 0 , event . srcEvent . pageY || 0 ] ) ;
43+ this . _el . children [ 0 ] . dispatchCommand ( 'setPressed' , [ true ] ) ;
4444 } ;
4545 this . _stop = ( event : any ) => {
46- this . _el . dispatchCommand ( 'hotspotUpdate' , [ event . srcEvent . clientX || 0 , event . srcEvent . clientY || 0 ] ) ;
47- this . _el . dispatchCommand ( 'setPressed' , [ false ] ) ;
46+ this . _el . children [ 0 ] . dispatchCommand ( 'hotspotUpdate' , [ event . srcEvent . pageX || 0 , event . srcEvent . pageY || 0 ] ) ;
47+ this . _el . children [ 0 ] . dispatchCommand ( 'setPressed' , [ false ] ) ;
4848 } ;
4949 }
5050
5151 ngOnInit ( ) {
52- this . _el . setProperty ( 'nativeBackgroundAndroid' , { type : 'RippleAndroid' , color : processColor ( this . nativeFeedback ) || - 1 , borderless : false } ) ;
53- this . _el . addEventListener ( 'tapstart' , this . _start ) ;
54- this . _el . addEventListener ( 'tapcancel' , this . _stop ) ;
55- this . _el . addEventListener ( 'tap' , this . _stop ) ;
52+ this . _el . children [ 0 ] . addEventListener ( 'tapstart' , this . _start ) ;
53+ this . _el . children [ 0 ] . addEventListener ( 'tapcancel' , this . _stop ) ;
54+ this . _el . children [ 0 ] . addEventListener ( 'tap' , this . _stop ) ;
55+ setTimeout ( ( ) => {
56+ this . _el . children [ 0 ] . setProperty ( 'nativeBackgroundAndroid' , { type : 'RippleAndroid' , color : processColor ( this . nativeFeedback ) || - 1 , borderless : false } ) ;
57+ } , 0 ) ;
5658 }
5759 ngOnDestroy ( ) {
58- this . _el . removeEventListener ( 'tapstart' , this . _start ) ;
59- this . _el . removeEventListener ( 'tapcancel' , this . _stop ) ;
60- this . _el . removeEventListener ( 'tap' , this . _stop ) ;
60+ this . _el . children [ 0 ] . removeEventListener ( 'tapstart' , this . _start ) ;
61+ this . _el . children [ 0 ] . removeEventListener ( 'tapcancel' , this . _stop ) ;
62+ this . _el . children [ 0 ] . removeEventListener ( 'tap' , this . _stop ) ;
6163 }
6264}
0 commit comments