@@ -30,46 +30,35 @@ function InkRippleService($window, $timeout) {
3030 attach : attach
3131 } ;
3232
33- function attachButtonBehavior ( scope , element ) {
34- return attach ( scope , element , {
33+ function attachButtonBehavior ( scope , element , options ) {
34+ return attach ( scope , element , angular . extend ( {
3535 isFAB : element . hasClass ( 'md-fab' ) ,
3636 isMenuItem : element . hasClass ( 'md-menu-item' ) ,
3737 center : false ,
3838 dimBackground : true
39- } ) ;
39+ } , options ) ) ;
4040 }
4141
42- function attachCheckboxBehavior ( scope , element ) {
43- return attach ( scope , element , {
42+ function attachCheckboxBehavior ( scope , element , options ) {
43+ return attach ( scope , element , angular . extend ( {
4444 center : true ,
4545 dimBackground : false
46- } ) ;
46+ } , options ) ) ;
4747 }
4848
49- function attachTabBehavior ( scope , element ) {
50- return attach ( scope , element , {
49+ function attachTabBehavior ( scope , element , options ) {
50+ return attach ( scope , element , angular . extend ( {
5151 center : false ,
5252 dimBackground : true ,
5353 outline : true
54- } ) ;
54+ } , options ) ) ;
5555 }
5656
5757 function attach ( scope , element , options ) {
5858 if ( element . controller ( 'mdNoInk' ) ) return angular . noop ;
5959
60- var rippleContainer , rippleSize ,
61- controller = element . controller ( 'mdInkRipple' ) || { } ,
62- counter = 0 ,
63- ripples = [ ] ,
64- states = [ ] ,
65- isActiveExpr = element . attr ( 'md-highlight' ) ,
66- isActive = false ,
67- isHeld = false ,
68- node = element [ 0 ] ,
69- hammertime = new Hammer ( node ) ,
70- color = parseColor ( element . attr ( 'md-ink-ripple' ) ) || parseColor ( $window . getComputedStyle ( node ) . color || 'rgb(0, 0, 0)' ) ;
71-
7260 options = angular . extend ( {
61+ colorElement : element ,
7362 mousedown : true ,
7463 hover : true ,
7564 focus : true ,
@@ -79,27 +68,34 @@ function InkRippleService($window, $timeout) {
7968 outline : false ,
8069 isFAB : false ,
8170 isMenuItem : false
82- } , options || { } ) ;
71+ } , options ) ;
72+
73+ var rippleContainer , rippleSize ,
74+ controller = element . controller ( 'mdInkRipple' ) || { } ,
75+ counter = 0 ,
76+ ripples = [ ] ,
77+ states = [ ] ,
78+ isActiveExpr = element . attr ( 'md-highlight' ) ,
79+ isActive = false ,
80+ isHeld = false ,
81+ node = element [ 0 ] ,
82+ hammertime = new Hammer ( node ) ,
83+ color = parseColor ( element . attr ( 'md-ink-ripple' ) ) || parseColor ( $window . getComputedStyle ( options . colorElement [ 0 ] ) . color || 'rgb(0, 0, 0)' ) ;
8384
8485 options . mousedown && hammertime . on ( 'hammer.input' , onInput ) ;
8586
8687 controller . createRipple = createRipple ;
8788
8889 if ( isActiveExpr ) {
89- scope . $watch (
90- function ( ) {
91- return scope . $eval ( isActiveExpr ) ;
92- } ,
93- function ( newValue ) {
94- isActive = newValue ;
95- if ( isActive && ! ripples . length ) {
96- $timeout ( function ( ) {
97- createRipple ( 0 , 0 ) ;
98- } , 0 , false ) ;
99- }
100- angular . forEach ( ripples , updateElement ) ;
101- }
102- ) ;
90+ scope . $watch ( isActiveExpr , function watchActive ( newValue ) {
91+ isActive = newValue ;
92+ if ( isActive && ! ripples . length ) {
93+ $timeout ( function ( ) {
94+ createRipple ( 0 , 0 ) ;
95+ } , 0 , false ) ;
96+ }
97+ angular . forEach ( ripples , updateElement ) ;
98+ } ) ;
10399 }
104100
105101 // Publish self-detach method if desired...
0 commit comments