Skip to content

Commit 4f7a02e

Browse files
committed
Pointer.position is now a Vec2 and x/y references to it
1 parent 8afa631 commit 4f7a02e

1 file changed

Lines changed: 30 additions & 2 deletions

File tree

v3/src/input/Pointer.js

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Phaser.Input.Pointer
22

33
var Class = require('../utils/Class');
4+
var Vector2 = require('../math/Vector2');
45

56
// DOM event button value:
67
// A number representing a given button:
@@ -36,8 +37,7 @@ var Pointer = new Class({
3637
// 16 : 5th button (typically the "Browser Forward" button)
3738
this.buttons = 0;
3839

39-
this.x = 0;
40-
this.y = 0;
40+
this.position = new Vector2();
4141

4242
// Coordinates and time of the pointer when Button 1 (left button), or Touch, was pressed, used for dragging objects
4343
this.downX = 0;
@@ -67,6 +67,34 @@ var Pointer = new Class({
6767
this.justMoved = false;
6868
},
6969

70+
x: {
71+
72+
get: function ()
73+
{
74+
return this.position.x;
75+
},
76+
77+
set: function (value)
78+
{
79+
this.position.x = value;
80+
}
81+
82+
},
83+
84+
y: {
85+
86+
get: function ()
87+
{
88+
return this.position.y;
89+
},
90+
91+
set: function (value)
92+
{
93+
this.position.y = value;
94+
}
95+
96+
},
97+
7098
reset: function ()
7199
{
72100
this.buttons = 0;

0 commit comments

Comments
 (0)