Skip to content

Commit ae3cd50

Browse files
committed
Fixed jsdocs
1 parent 08a968f commit ae3cd50

7 files changed

Lines changed: 219 additions & 64 deletions

File tree

src/cameras/2d/Camera.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -834,6 +834,7 @@ var Camera = new Class({
834834
* @since 3.0.0
835835
*
836836
* @param {number} baseScale - [description]
837+
* @param {number} resolution - [description]
837838
*
838839
*/
839840
preRender: function (baseScale, resolution)

src/display/canvas/CanvasInterpolation.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
*/
66

77
/**
8-
* @module Phaser.Display.Canvas.CanvasInterpolation
8+
* @namespace Phaser.Display.Canvas.CanvasInterpolation
99
* @since 3.0.0
1010
*/
1111
var CanvasInterpolation = {
1212

1313
/**
1414
* Sets the CSS image-rendering property on the given canvas to be 'crisp' (aka 'optimize contrast' on webkit).
1515
*
16-
* @function setCrisp
16+
* @function Phaser.Display.Canvas.CanvasInterpolation.setCrisp
1717
* @since 3.0.0
1818
*
1919
* @param {HTMLCanvasElement} canvas - The canvas object to have the style set on.
@@ -37,7 +37,7 @@ var CanvasInterpolation = {
3737
/**
3838
* Sets the CSS image-rendering property on the given canvas to be 'bicubic' (aka 'auto').
3939
*
40-
* @function setBicubic
40+
* @function Phaser.Display.Canvas.CanvasInterpolation.setBicubic
4141
* @since 3.0.0
4242
*
4343
* @param {HTMLCanvasElement} canvas - The canvas object to have the style set on.

src/display/canvas/CanvasPool.js

Lines changed: 95 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,32 @@ var pool = [];
1313
// Automatically apply smoothing(false) to created Canvas elements
1414
var _disableContextSmoothing = false;
1515

16-
// This singleton is instantiated as soon as Phaser loads,
17-
// before a Phaser.Game instance has even been created.
18-
// Which means all instances of Phaser Games on the same page
19-
// can share the one single pool
20-
21-
// The CanvasPool is a global static object, that allows Phaser to recycle and pool Canvas DOM elements.
16+
/**
17+
* The CanvasPool is a global static object, that allows Phaser to recycle and pool Canvas DOM elements.
18+
*
19+
* This singleton is instantiated as soon as Phaser loads,
20+
* before a Phaser.Game instance has even been created.
21+
* Which means all instances of Phaser Games on the same page
22+
* can share the one single pool
23+
*
24+
* @namespace Phaser.Display.Canvas.CanvasPool
25+
* @since 3.0.0
26+
*/
2227
var CanvasPool = function ()
2328
{
24-
// Creates a new Canvas DOM element, or pulls one from the pool if free.
29+
/**
30+
* Creates a new Canvas DOM element, or pulls one from the pool if free.
31+
*
32+
* @function Phaser.Display.Canvas.CanvasPool.create
33+
* @since 3.0.0
34+
*
35+
* @param {any} parent - [description]
36+
* @param {integer} [width=1] - [description]
37+
* @param {integer} [height=1] - [description]
38+
* @param {integer} [type] - [description]
39+
*
40+
* @return {HTMLCanvasElement} [description]
41+
*/
2542
var create = function (parent, width, height, type)
2643
{
2744
if (width === undefined) { width = 1; }
@@ -61,17 +78,50 @@ var CanvasPool = function ()
6178
return canvas;
6279
};
6380

81+
/**
82+
* Creates a new Canvas DOM element, or pulls one from the pool if free.
83+
*
84+
* @function Phaser.Display.Canvas.CanvasPool.create2D
85+
* @since 3.0.0
86+
*
87+
* @param {any} parent - [description]
88+
* @param {integer} [width=1] - [description]
89+
* @param {integer} [height=1] - [description]
90+
*
91+
* @return {HTMLCanvasElement} [description]
92+
*/
6493
var create2D = function (parent, width, height)
6594
{
6695
return create(parent, width, height, CONST.CANVAS);
6796
};
6897

98+
/**
99+
* Creates a new Canvas DOM element, or pulls one from the pool if free.
100+
*
101+
* @function Phaser.Display.Canvas.CanvasPool.createWebGL
102+
* @since 3.0.0
103+
*
104+
* @param {any} parent - [description]
105+
* @param {integer} [width=1] - [description]
106+
* @param {integer} [height=1] - [description]
107+
*
108+
* @return {HTMLCanvasElement} [description]
109+
*/
69110
var createWebGL = function (parent, width, height)
70111
{
71112
return create(parent, width, height, CONST.WEBGL);
72113
};
73114

74-
// Gets the first free canvas index from the pool.
115+
/**
116+
* Gets the first free canvas index from the pool.
117+
*
118+
* @function Phaser.Display.Canvas.CanvasPool.first
119+
* @since 3.0.0
120+
*
121+
* @param {integer} [type] - [description]
122+
*
123+
* @return {HTMLCanvasElement} [description]
124+
*/
75125
var first = function (type)
76126
{
77127
if (type === undefined) { type = CONST.CANVAS; }
@@ -87,8 +137,15 @@ var CanvasPool = function ()
87137
return null;
88138
};
89139

90-
// Looks up a canvas based on its parent, and if found puts it back in the pool, freeing it up for re-use.
91-
// The canvas has its width and height set to 1, and its parent attribute nulled.
140+
/**
141+
* Looks up a canvas based on its parent, and if found puts it back in the pool, freeing it up for re-use.
142+
* The canvas has its width and height set to 1, and its parent attribute nulled.
143+
*
144+
* @function Phaser.Display.Canvas.CanvasPool.remove
145+
* @since 3.0.0
146+
*
147+
* @param {any} parent - [description]
148+
*/
92149
var remove = function (parent)
93150
{
94151
// Check to see if the parent is a canvas object
@@ -106,7 +163,14 @@ var CanvasPool = function ()
106163
});
107164
};
108165

109-
// Gets the total number of used canvas elements in the pool.
166+
/**
167+
* Gets the total number of used canvas elements in the pool.
168+
*
169+
* @function Phaser.Display.Canvas.CanvasPool.total
170+
* @since 3.0.0
171+
*
172+
* @return {integer} [description]
173+
*/
110174
var total = function ()
111175
{
112176
var c = 0;
@@ -122,19 +186,36 @@ var CanvasPool = function ()
122186
return c;
123187
};
124188

125-
// Gets the total number of free canvas elements in the pool.
189+
/**
190+
* Gets the total number of free canvas elements in the pool.
191+
*
192+
* @function Phaser.Display.Canvas.CanvasPool.free
193+
* @since 3.0.0
194+
*
195+
* @return {integer} [description]
196+
*/
126197
var free = function ()
127198
{
128199
return pool.length - total();
129200
};
130201

131-
// Disable context smoothing on any new Canvas element created
202+
/**
203+
* Disable context smoothing on any new Canvas element created.
204+
*
205+
* @function Phaser.Display.Canvas.CanvasPool.disableSmoothing
206+
* @since 3.0.0
207+
*/
132208
var disableSmoothing = function ()
133209
{
134210
_disableContextSmoothing = true;
135211
};
136212

137-
// Enable context smoothing on any new Canvas element created
213+
/**
214+
* Enable context smoothing on any new Canvas element created.
215+
*
216+
* @function Phaser.Display.Canvas.CanvasPool.enableSmoothing
217+
* @since 3.0.0
218+
*/
138219
var enableSmoothing = function ()
139220
{
140221
_disableContextSmoothing = false;

src/display/canvas/Smoothing.js

Lines changed: 48 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,25 @@
44
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
55
*/
66

7-
87
// Browser specific prefix, so not going to change between contexts, only between browsers
98
var prefix = '';
109

10+
/**
11+
* @namespace Phaser.Display.Canvas.Smoothing
12+
* @since 3.0.0
13+
*/
1114
var Smoothing = function ()
1215
{
13-
// Gets the Smoothing Enabled vendor prefix being used on the given context, or null if not set.
16+
/**
17+
* Gets the Smoothing Enabled vendor prefix being used on the given context, or null if not set.
18+
*
19+
* @function Phaser.Display.Canvas.Smoothing.getPrefix
20+
* @since 3.0.0
21+
*
22+
* @param {[type]} context - [description]
23+
*
24+
* @return {string} [description]
25+
*/
1426
var getPrefix = function (context)
1527
{
1628
var vendors = [ 'i', 'webkitI', 'msI', 'mozI', 'oI' ];
@@ -29,12 +41,19 @@ var Smoothing = function ()
2941
};
3042

3143
/**
32-
* Sets the Image Smoothing property on the given context. Set to false to disable image smoothing.
33-
* By default browsers have image smoothing enabled, which isn't always what you visually want, especially
34-
* when using pixel art in a game. Note that this sets the property on the context itself, so that any image
35-
* drawn to the context will be affected. This sets the property across all current browsers but support is
36-
* patchy on earlier browsers, especially on mobile.
37-
*/
44+
* Sets the Image Smoothing property on the given context. Set to false to disable image smoothing.
45+
* By default browsers have image smoothing enabled, which isn't always what you visually want, especially
46+
* when using pixel art in a game. Note that this sets the property on the context itself, so that any image
47+
* drawn to the context will be affected. This sets the property across all current browsers but support is
48+
* patchy on earlier browsers, especially on mobile.
49+
*
50+
* @function Phaser.Display.Canvas.Smoothing.enable
51+
* @since 3.0.0
52+
*
53+
* @param {[type]} context - [description]
54+
*
55+
* @return {[type]} [description]
56+
*/
3857
var enable = function (context)
3958
{
4059
if (prefix === '')
@@ -51,12 +70,19 @@ var Smoothing = function ()
5170
};
5271

5372
/**
54-
* Sets the Image Smoothing property on the given context. Set to false to disable image smoothing.
55-
* By default browsers have image smoothing enabled, which isn't always what you visually want, especially
56-
* when using pixel art in a game. Note that this sets the property on the context itself, so that any image
57-
* drawn to the context will be affected. This sets the property across all current browsers but support is
58-
* patchy on earlier browsers, especially on mobile.
59-
*/
73+
* Sets the Image Smoothing property on the given context. Set to false to disable image smoothing.
74+
* By default browsers have image smoothing enabled, which isn't always what you visually want, especially
75+
* when using pixel art in a game. Note that this sets the property on the context itself, so that any image
76+
* drawn to the context will be affected. This sets the property across all current browsers but support is
77+
* patchy on earlier browsers, especially on mobile.
78+
*
79+
* @function Phaser.Display.Canvas.Smoothing.disable
80+
* @since 3.0.0
81+
*
82+
* @param {[type]} context - [description]
83+
*
84+
* @return {[type]} [description]
85+
*/
6086
var disable = function (context)
6187
{
6288
if (prefix === '')
@@ -75,6 +101,13 @@ var Smoothing = function ()
75101
/**
76102
* Returns `true` if the given context has image smoothing enabled, otherwise returns `false`.
77103
* Returns null if no smoothing prefix is available.
104+
*
105+
* @function Phaser.Display.Canvas.Smoothing.isEnabled
106+
* @since 3.0.0
107+
*
108+
* @param {[type]} context - [description]
109+
*
110+
* @return {boolean} [description]
78111
*/
79112
var isEnabled = function (context)
80113
{
@@ -87,6 +120,7 @@ var Smoothing = function ()
87120
getPrefix: getPrefix,
88121
isEnabled: isEnabled
89122
};
123+
90124
};
91125

92126
module.exports = Smoothing();

0 commit comments

Comments
 (0)