Skip to content

Commit f9cda63

Browse files
committed
Added Camera.screenToCamera and setAngle methods.
1 parent 43dbe52 commit f9cda63

3 files changed

Lines changed: 26 additions & 0 deletions

File tree

v3/src/camera/2d/Camera.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ var Camera = new Class({
7777
ignore: require('./inc/Ignore'),
7878
preRender: require('./inc/PreRender'),
7979
removeBounds: require('./inc/RemoveBounds'),
80+
screenToCamera: require('./inc/ScreenToCamera'),
81+
setAngle: require('./inc/SetAngle'),
8082
setBackgroundColor: require('./inc/SetBackgroundColor'),
8183
setBounds: require('./inc/SetBounds'),
8284
setName: require('./inc/SetName'),
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
var ScreenToCamera = function (x, y, pointOut)
2+
{
3+
this.matrix.transformPoint(x, y, pointOut);
4+
5+
// Add in the scroll offset
6+
pointOut.x += this.scrollX;
7+
pointOut.y += this.scrollY;
8+
9+
return pointOut;
10+
};
11+
12+
module.exports = ScreenToCamera;

v3/src/camera/2d/inc/SetAngle.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
var DegToRad = require('../../../math/DegToRad');
2+
3+
var SetAngle = function (value)
4+
{
5+
if (value === undefined) { value = 0; }
6+
7+
this.rotation = DegToRad(value);
8+
9+
return this;
10+
};
11+
12+
module.exports = SetAngle;

0 commit comments

Comments
 (0)