forked from phaserjs/phaser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInCamera.js
More file actions
36 lines (28 loc) · 912 Bytes
/
InCamera.js
File metadata and controls
36 lines (28 loc) · 912 Bytes
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
/**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2015 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
/**
* The InCamera component checks if the Game Object intersects with the Game Camera.
*
* @class
*/
Phaser.Component.InCamera = function () {};
Phaser.Component.InCamera.prototype = {
/**
* Checks if this Game Objects bounds intersects with the Game Cameras bounds.
*
* It will be `true` if they intersect, or `false` if the Game Object is fully outside of the Cameras bounds.
*
* An object outside the bounds can be considered for camera culling if it has the AutoCull component.
*
* @property {boolean} inCamera
* @readonly
*/
inCamera: {
get: function() {
return this.game.world.camera.view.intersects(this._bounds);
}
}
};