-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTouch.js
41 lines (32 loc) · 1.06 KB
/
Touch.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import * as Vec2 from 'foam-math/Vec2';
function Touch(){
this._id = 0;
this._positionPrev = Vec2.create();
this._positionPrevNormalized = Vec2.create();
this._position = Vec2.create();
this._positionNormalized = Vec2.create();
this._positionDelta = Vec2.create();
this._direction = Vec2.create();
}
Touch.prototype.getId = function(){
return this._id;
};
Touch.prototype.getPosition = function(out){
return Vec2.set(out || Vec2.create(),this._position);
};
Touch.prototype.getPositionNormalized = function(out){
return Vec2.set(out || Vec2.create(),this._positionNormalized);
};
Touch.prototype.getPositionPrev = function(out){
return Vec2.set(out || Vec2.create(),this._positionPrev);
};
Touch.prototype.getPositionPrevNormalized = function(out){
return Vec2.set(out || Vec2.create(),this._positionPrevNormalized);
};
Touch.prototype.getDelta = function(out){
return Vec2.set(out || Vec2.create(), out);
};
Touch.prototype.getDirection = function(out){
return Vec2.set(out || Vec2.create(), out);
};
export default Touch;