@@ -63,10 +63,10 @@ var InputManager = new Class({
6363 this . canvas ;
6464
6565 /**
66- * The Input Configuration object, as set in the Game Config .
66+ * The Game Configuration object, as set during the game boot .
6767 *
6868 * @name Phaser.Input.InputManager#config
69- * @type {object }
69+ * @type {Phaser.Boot.Config }
7070 * @since 3.0.0
7171 */
7272 this . config = config ;
@@ -226,7 +226,11 @@ var InputManager = new Class({
226226
227227 for ( var i = 0 ; i <= this . pointersTotal ; i ++ )
228228 {
229- this . pointers . push ( new Pointer ( this , i ) ) ;
229+ var pointer = new Pointer ( this , i ) ;
230+
231+ pointer . smoothFactor = config . inputSmoothFactor ;
232+
233+ this . pointers . push ( pointer ) ;
230234 }
231235
232236 /**
@@ -768,6 +772,8 @@ var InputManager = new Class({
768772
769773 var pointer = new Pointer ( this , id ) ;
770774
775+ pointer . smoothFactor = this . config . inputSmoothFactor ;
776+
771777 this . pointers . push ( pointer ) ;
772778
773779 this . pointersTotal ++ ;
@@ -1310,15 +1316,35 @@ var InputManager = new Class({
13101316 * @param {Phaser.Input.Pointer } pointer - The Pointer to transform the values for.
13111317 * @param {number } pageX - The Page X value.
13121318 * @param {number } pageY - The Page Y value.
1319+ * @param {boolean } wasMove - Are we transforming the Pointer from a move event, or an up / down event?
13131320 */
1314- transformPointer : function ( pointer , pageX , pageY )
1321+ transformPointer : function ( pointer , pageX , pageY , wasMove )
13151322 {
1316- // Store the previous position
1317- pointer . prevPosition . x = pointer . x ;
1318- pointer . prevPosition . y = pointer . y ;
1323+ var p0 = pointer . position ;
1324+ var p1 = pointer . prevPosition ;
1325+
1326+ // Store previous position
1327+ p1 . x = p0 . x ;
1328+ p1 . y = p0 . y ;
1329+
1330+ // Translate coordinates
1331+ var x = ( pageX - this . bounds . left ) * this . scale . x ;
1332+ var y = ( pageY - this . bounds . top ) * this . scale . y ;
13191333
1320- pointer . x = ( pageX - this . bounds . left ) * this . scale . x ;
1321- pointer . y = ( pageY - this . bounds . top ) * this . scale . y ;
1334+ var a = pointer . smoothFactor ;
1335+
1336+ if ( ! wasMove || a === 0 )
1337+ {
1338+ // Set immediately
1339+ p0 . x = x ;
1340+ p0 . y = y ;
1341+ }
1342+ else
1343+ {
1344+ // Apply smoothing
1345+ p0 . x = x * a + p1 . x * ( 1 - a ) ;
1346+ p0 . y = y * a + p1 . y * ( 1 - a ) ;
1347+ }
13221348 } ,
13231349
13241350 /**
0 commit comments