@@ -207,27 +207,36 @@ Phaser.Touch.prototype = {
207207 * @method Phaser.Touch#addTouchLockCallback
208208 * @param {function } callback - The callback that will be called when a touchstart event is received.
209209 * @param {object } context - The context in which the callback will be called.
210- * @return {number } The index of the callback entry. Use this index when calling Touch.removeTouchLockCallback.
211210 */
212211 addTouchLockCallback : function ( callback , context ) {
213212
214- return this . touchLockCallbacks . push ( { callback : callback , context : context } ) - 1 ;
213+ this . touchLockCallbacks . push ( { callback : callback , context : context } ) ;
215214
216215 } ,
217216
218217 /**
219218 * Removes the callback at the defined index from the Phaser.Touch.touchLockCallbacks array
220219 *
221220 * @method Phaser.Touch#removeTouchLockCallback
222- * @param {number } index - The index of the callback to remove.
221+ * @param {function } callback - The callback to be removed.
222+ * @param {object } context - The context in which the callback exists.
223+ * @return {boolean } True if the callback was deleted, otherwise false.
223224 */
224- removeTouchLockCallback : function ( index ) {
225+ removeTouchLockCallback : function ( callback , context ) {
225226
226- if ( this . touchLockCallbacks [ index ] )
227+ var i = this . touchLockCallbacks . length ;
228+
229+ while ( i -- )
227230 {
228- this . touchLockCallbacks . splice ( index , 1 ) ;
231+ if ( this . touchLockCallbacks [ i ] . callback === callback && this . touchLockCallbacks [ i ] . context === context )
232+ {
233+ this . touchLockCallbacks . splice ( i , 1 ) ;
234+ return true ;
235+ }
229236 }
230237
238+ return false ;
239+
231240 } ,
232241
233242 /**
0 commit comments