@@ -135,8 +135,8 @@ InkRippleCtrl.prototype._parseColor = function parseColor (color, multiplier) {
135
135
*/
136
136
InkRippleCtrl . prototype . bindEvents = function ( ) {
137
137
this . $element . on ( 'mousedown' , angular . bind ( this , this . handleMousedown ) ) ;
138
- this . $element . on ( 'mouseup' , angular . bind ( this , this . handleMouseup ) ) ;
139
- this . $element . on ( 'mouseleave ' , angular . bind ( this , this . handleMouseup ) ) ;
138
+ this . $element . on ( 'mouseup touchend mouseleave ' , angular . bind ( this , this . handleMouseup ) ) ;
139
+ this . $element . on ( 'touchmove ' , angular . bind ( this , this . handleTouchmove ) ) ;
140
140
} ;
141
141
142
142
/**
@@ -162,18 +162,46 @@ InkRippleCtrl.prototype.handleMousedown = function (event) {
162
162
* Either remove or unlock any remaining ripples when the user mouses off of the element (either by
163
163
* mouseup or mouseleave event)
164
164
*/
165
- InkRippleCtrl . prototype . handleMouseup = function ( ) {
165
+ InkRippleCtrl . prototype . _handleRemoval = function ( cb ) {
166
166
if ( this . mousedown || this . lastRipple ) {
167
- var ctrl = this ;
168
167
this . mousedown = false ;
169
168
this . $mdUtil . nextTick ( function ( ) {
170
- ctrl . clearRipples ( ) ;
169
+ cb ( ) ;
171
170
} , false ) ;
172
171
}
173
172
} ;
174
173
174
+ /**
175
+ * Either remove or unlock any remaining ripples when the user mouses off of the element (either by
176
+ * mouseup, touchend or mouseleave event)
177
+ */
178
+ InkRippleCtrl . prototype . handleMouseup = function ( ) {
179
+ var ctrl = this ;
180
+
181
+ ctrl . _handleRemoval ( angular . bind ( ctrl , ctrl . clearRipples ) ) ;
182
+ } ;
183
+
184
+ /**
185
+ * Either remove or unlock any remaining ripples when the user mouses off of the element (by
186
+ * touchmove)
187
+ */
188
+ InkRippleCtrl . prototype . handleTouchmove = function ( ) {
189
+ var ctrl = this ;
190
+
191
+ ctrl . _handleRemoval ( angular . bind ( ctrl , ctrl . deleteRipples ) ) ;
192
+ } ;
193
+
175
194
/**
176
195
* Cycles through all ripples and attempts to remove them.
196
+ */
197
+ InkRippleCtrl . prototype . deleteRipples = function ( ) {
198
+ for ( var i = 0 ; i < this . ripples . length ; i ++ ) {
199
+ this . ripples [ i ] . remove ( ) ;
200
+ }
201
+ } ;
202
+
203
+ /**
204
+ * Cycles through all ripples and attempts to remove them with fade.
177
205
* Depending on logic within `fadeInComplete`, some removals will be postponed.
178
206
*/
179
207
InkRippleCtrl . prototype . clearRipples = function ( ) {
0 commit comments