Skip to content

Commit 61c5f76

Browse files
committed
Added transformPointer method which Pointer now uses.
1 parent 130ab75 commit 61c5f76

2 files changed

Lines changed: 111 additions & 67 deletions

File tree

src/input/InputManager.js

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,15 @@ var TransformXY = require('../math/TransformXY');
1818

1919
/**
2020
* @classdesc
21-
* [description]
21+
* The Input Manager is responsible for handling all of the input related systems in a single Phaser Game instance.
22+
*
23+
* Based on the Game Config it will create handlers for mouse, touch, keyboard and gamepad support.
24+
*
25+
* It then manages the event queue, pointer creation and general hit test related operations.
26+
*
27+
* You rarely need to interact with the Input Manager directly, and as such, all of its properties and methods
28+
* should be considered private. Instead, you should use the Input Plugin, which is a Scene level system, responsible
29+
* for dealing with all input events for a Scene.
2230
*
2331
* @class InputManager
2432
* @memberOf Phaser.Input
@@ -1060,6 +1068,22 @@ var InputManager = new Class({
10601068
return object.hitAreaCallback(object.hitArea, x, y, object);
10611069
},
10621070

1071+
/**
1072+
* Transforms the pageX and pageY values of a Pointer into the scaled coordinate space of the Input Manager.
1073+
*
1074+
* @method Phaser.Input.InputManager#transformPointer
1075+
* @since 3.10.0
1076+
*
1077+
* @param {Phaser.Input.Pointer} pointer - The Pointer to transform the values for.
1078+
*
1079+
* @return {number} The translated value.
1080+
*/
1081+
transformPointer: function (pointer, pageX, pageY)
1082+
{
1083+
pointer.x = (pageX - this.bounds.left) * this.scale.x;
1084+
pointer.y = (pageY - this.bounds.top) * this.scale.y;
1085+
},
1086+
10631087
/**
10641088
* Transforms the pageX value into the scaled coordinate space of the Input Manager.
10651089
*

0 commit comments

Comments
 (0)