melonjs 10.10.0 → 10.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/README.md +4 -3
  2. package/dist/melonjs.js +817 -1922
  3. package/dist/melonjs.min.js +4 -4
  4. package/dist/melonjs.module.d.ts +339 -1183
  5. package/dist/melonjs.module.js +745 -1846
  6. package/package.json +12 -15
  7. package/src/audio/audio.js +0 -1
  8. package/src/camera/camera2d.js +1 -16
  9. package/src/entity/entity.js +1 -4
  10. package/src/geometries/ellipse.js +2 -11
  11. package/src/geometries/line.js +1 -4
  12. package/src/geometries/path2d.js +0 -10
  13. package/src/geometries/poly.js +5 -22
  14. package/src/geometries/rectangle.js +2 -14
  15. package/src/geometries/roundrect.js +2 -6
  16. package/src/index.js +0 -1
  17. package/src/input/gamepad.js +3 -14
  18. package/src/input/keyboard.js +1 -9
  19. package/src/input/pointer.js +0 -1
  20. package/src/input/pointerevent.js +14 -23
  21. package/src/lang/deprecated.js +4 -3
  22. package/src/level/level.js +0 -9
  23. package/src/level/tiled/TMXGroup.js +0 -4
  24. package/src/level/tiled/TMXLayer.js +0 -8
  25. package/src/level/tiled/TMXObject.js +0 -3
  26. package/src/level/tiled/TMXTile.js +4 -5
  27. package/src/level/tiled/TMXTileMap.js +1 -7
  28. package/src/level/tiled/TMXTileset.js +0 -5
  29. package/src/level/tiled/TMXTilesetGroup.js +1 -4
  30. package/src/level/tiled/TMXUtils.js +0 -3
  31. package/src/level/tiled/renderer/TMXHexagonalRenderer.js +2 -3
  32. package/src/level/tiled/renderer/TMXIsometricRenderer.js +0 -1
  33. package/src/level/tiled/renderer/TMXRenderer.js +1 -7
  34. package/src/loader/loader.js +0 -11
  35. package/src/loader/loadingscreen.js +1 -1
  36. package/src/math/color.js +5 -26
  37. package/src/math/math.js +0 -10
  38. package/src/math/matrix2.js +12 -27
  39. package/src/math/matrix3.js +1 -22
  40. package/src/math/observable_vector2.js +0 -29
  41. package/src/math/observable_vector3.js +0 -29
  42. package/src/math/vector2.js +3 -40
  43. package/src/math/vector3.js +4 -41
  44. package/src/particles/emitter.js +1 -1
  45. package/src/physics/body.js +1 -1
  46. package/src/physics/bounds.js +5 -19
  47. package/src/physics/collision.js +0 -1
  48. package/src/physics/detector.js +0 -4
  49. package/src/physics/quadtree.js +0 -7
  50. package/src/physics/sat.js +3 -3
  51. package/src/physics/world.js +0 -4
  52. package/src/plugin/plugin.js +0 -2
  53. package/src/polyfill/roundrect.js +4 -2
  54. package/src/renderable/GUI.js +0 -5
  55. package/src/renderable/collectable.js +1 -0
  56. package/src/renderable/container.js +0 -28
  57. package/src/renderable/dragndrop.js +0 -9
  58. package/src/renderable/imagelayer.js +1 -5
  59. package/src/renderable/light2d.js +1 -2
  60. package/src/renderable/renderable.js +0 -22
  61. package/src/renderable/sprite.js +0 -12
  62. package/src/renderable/trigger.js +1 -1
  63. package/src/state/stage.js +0 -4
  64. package/src/state/state.js +3 -20
  65. package/src/system/device.js +14 -53
  66. package/src/system/event.js +11 -0
  67. package/src/system/pooling.js +19 -8
  68. package/src/system/save.js +9 -11
  69. package/src/system/timer.js +239 -218
  70. package/src/text/bitmaptextdata.js +1 -4
  71. package/src/text/glyph.js +2 -2
  72. package/src/text/text.js +7 -5
  73. package/src/text/textmetrics.js +0 -2
  74. package/src/tweens/easing.js +1 -1
  75. package/src/tweens/interpolation.js +2 -2
  76. package/src/tweens/tween.js +1 -13
  77. package/src/utils/agent.js +1 -3
  78. package/src/utils/array.js +0 -3
  79. package/src/utils/file.js +0 -2
  80. package/src/utils/function.js +0 -2
  81. package/src/utils/string.js +0 -6
  82. package/src/utils/utils.js +0 -3
  83. package/src/video/canvas/canvas_renderer.js +4 -39
  84. package/src/video/renderer.js +1 -23
  85. package/src/video/texture/cache.js +0 -1
  86. package/src/video/texture/canvas_texture.js +16 -4
  87. package/src/video/video.js +3 -3
  88. package/src/video/webgl/glshader.js +0 -5
  89. package/src/video/webgl/utils/uniforms.js +3 -6
  90. package/src/video/webgl/webgl_compositor.js +0 -14
  91. package/src/video/webgl/webgl_renderer.js +0 -42
@@ -1,96 +1,16 @@
1
1
  import utils from "./../utils/utils.js";
2
- import * as event from "./../system/event.js";
2
+ import * as event from "./event.js";
3
3
  import state from "./../state/state.js";
4
4
  import { clamp } from "./../math/math.js";
5
5
 
6
- //hold element to display fps
7
- var framecount = 0;
8
- var framedelta = 0;
9
-
10
- /* fps count stuff */
11
- var last = 0;
12
- var now = 0;
13
- var delta = 0;
14
- // for timeout/interval update
15
- var step =0;
16
- var minstep = 0;
17
-
18
- // list of defined timer function
19
- var timers = [];
20
- var timerId = 0;
21
-
22
- /**
23
- * update
24
- * @ignore
25
- */
26
- function update(time) {
27
- last = now;
28
- now = time;
29
- delta = (now - last);
30
-
31
- // fix for negative timestamp returned by wechat or chrome on startup
32
- if (delta < 0) {
33
- delta = 0;
34
- }
35
-
36
- // get the game tick
37
- timer.tick = (delta > minstep && timer.interpolation) ? delta / step : 1;
38
-
39
-
40
- updateTimers();
41
- };
42
-
43
- /**
44
- * clear Timers
45
- * @ignore
46
- */
47
- function clearTimer(timerId) {
48
- for (var i = 0, len = timers.length; i < len; i++) {
49
- if (timers[i].timerId === timerId) {
50
- timers.splice(i, 1);
51
- break;
52
- }
53
- }
54
- };
55
-
56
-
57
- /**
58
- * update timers
59
- * @ignore
60
- */
61
- function updateTimers() {
62
- for (var i = 0, len = timers.length; i < len; i++) {
63
- var _timer = timers[i];
64
- if (!(_timer.pauseable && state.isPaused())) {
65
- _timer.elapsed += delta;
66
- }
67
- if (_timer.elapsed >= _timer.delay) {
68
- _timer.fn.apply(null, _timer.args);
69
- if (_timer.repeat === true) {
70
- _timer.elapsed -= _timer.delay;
71
- } else {
72
- timer.clearTimeout(_timer.timerId);
73
- }
74
- }
75
- }
76
- };
77
-
78
- // Initialize me.timer on Boot event
79
- event.on(event.BOOT, () => {
80
- // reset variables to initial state
81
- timer.reset();
82
- now = last = 0;
83
- // register to the game before update event
84
- event.on(event.GAME_BEFORE_UPDATE, update);
85
- });
86
-
87
-
88
6
  /**
7
+ * @classdesc
89
8
  * a Timer class to manage timing related function (FPS, Game Tick, Time...)
90
- * @namespace timer
9
+ * @see {@link timer} the default global timer instance
91
10
  */
92
- var timer = {
11
+ class Timer {
93
12
 
13
+ constructor() {
94
14
  /**
95
15
  * Last game tick value.<br/>
96
16
  * Use this value to scale velocities during frame drops due to slow
@@ -103,7 +23,7 @@ var timer = {
103
23
  * @name tick
104
24
  * @memberof timer
105
25
  */
106
- tick : 1.0,
26
+ this.tick = 1.0;
107
27
 
108
28
  /**
109
29
  * Last measured fps rate.<br/>
@@ -113,7 +33,7 @@ var timer = {
113
33
  * @name fps
114
34
  * @memberof timer
115
35
  */
116
- fps : 0,
36
+ this.fps = 0;
117
37
 
118
38
  /**
119
39
  * Set the maximum target display frame per second
@@ -124,7 +44,7 @@ var timer = {
124
44
  * @default 60
125
45
  * @memberof timer
126
46
  */
127
- maxfps : 60,
47
+ this.maxfps = 60;
128
48
 
129
49
  /**
130
50
  * Enable/disable frame interpolation
@@ -134,146 +54,247 @@ var timer = {
134
54
  * @name interpolation
135
55
  * @memberof timer
136
56
  */
137
- interpolation : false,
57
+ this.interpolation = false;
138
58
 
139
- /**
140
- * reset time (e.g. usefull in case of pause)
141
- * @name reset
142
- * @memberof timer
143
- * @ignore
144
- * @function
145
- */
146
- reset() {
147
- // set to "now"
148
- last = now = globalThis.performance.now();
149
- delta = 0;
150
- // reset delta counting variables
151
- framedelta = 0;
152
- framecount = 0;
153
- step = Math.ceil(1000 / this.maxfps); // ROUND IT ?
154
- // define some step with some margin
155
- minstep = (1000 / this.maxfps) * 1.25; // IS IT NECESSARY?\
156
- },
59
+ //hold element to display fps
60
+ this.framecount = 0;
61
+ this.framedelta = 0;
157
62
 
158
- /**
159
- * Calls a function once after a specified delay. See me.timer.setInterval to repeativly call a function.
160
- * @name setTimeout
161
- * @memberof timer
162
- * @param {Function} fn the function you want to execute after delay milliseconds.
163
- * @param {number} delay the number of milliseconds (thousandths of a second) that the function call should be delayed by.
164
- * @param {boolean} [pauseable=true] respects the pause state of the engine.
165
- * @param {...*} args optional parameters which are passed through to the function specified by fn once the timer expires.
166
- * @returns {number} The numerical ID of the timer, which can be used later with me.timer.clearTimeout().
167
- * @function
168
- * @example
169
- * // set a timer to call "myFunction" after 1000ms
170
- * me.timer.setTimeout(myFunction, 1000);
171
- * // set a timer to call "myFunction" after 1000ms (respecting the pause state) and passing param1 and param2
172
- * me.timer.setTimeout(myFunction, 1000, true, param1, param2);
173
- */
174
- setTimeout(fn, delay, pauseable, ...args) {
175
- timers.push({
176
- fn : fn,
177
- delay : delay,
178
- elapsed : 0,
179
- repeat : false,
180
- timerId : ++timerId,
181
- pauseable : pauseable === true || true,
182
- args : args
183
- });
184
- return timerId;
185
- },
63
+ /* fps count stuff */
64
+ this.last = 0;
65
+ this.now = 0;
66
+ this.delta = 0;
67
+ // for timeout/interval update
68
+ this.step =0;
69
+ this.minstep = 0;
186
70
 
187
- /**
188
- * Calls a function continously at the specified interval. See setTimeout to call function a single time.
189
- * @name setInterval
190
- * @memberof timer
191
- * @param {Function} fn the function to execute
192
- * @param {number} delay the number of milliseconds (thousandths of a second) on how often to execute the function
193
- * @param {boolean} [pauseable=true] respects the pause state of the engine.
194
- * @param {...*} args optional parameters which are passed through to the function specified by fn once the timer expires.
195
- * @returns {number} The numerical ID of the timer, which can be used later with me.timer.clearInterval().
196
- * @function
197
- * @example
198
- * // set a timer to call "myFunction" every 1000ms
199
- * me.timer.setInterval(myFunction, 1000);
200
- * // set a timer to call "myFunction" every 1000ms (respecting the pause state) and passing param1 and param2
201
- * me.timer.setInterval(myFunction, 1000, true, param1, param2);
202
- */
203
- setInterval(fn, delay, pauseable, ...args) {
204
- timers.push({
205
- fn : fn,
206
- delay : delay,
207
- elapsed : 0,
208
- repeat : true,
209
- timerId : ++timerId,
210
- pauseable : pauseable === true || true,
211
- args : args
212
- });
213
- return timerId;
214
- },
71
+ // list of defined timer function
72
+ this.timers = [];
73
+ this.timerId = 0;
215
74
 
216
- /**
217
- * Clears the delay set by me.timer.setTimeout().
218
- * @name clearTimeout
219
- * @memberof timer
220
- * @function
221
- * @param {number} timeoutID ID of the timeout to be cleared
222
- */
223
- clearTimeout(timeoutID) {
224
- utils.function.defer(clearTimer, this, timeoutID);
225
- },
75
+ // Initialize mtimer on Boot event
76
+ event.on(event.BOOT, () => {
77
+ // reset variables to initial state
78
+ this.reset();
79
+ this.now = this.last = 0;
80
+ // register to the game before update event
81
+ event.on(event.GAME_BEFORE_UPDATE, this.update.bind(this));
82
+ });
226
83
 
227
- /**
228
- * Clears the Interval set by me.timer.setInterval().
229
- * @name clearInterval
230
- * @memberof timer
231
- * @function
232
- * @param {number} intervalID ID of the interval to be cleared
233
- */
234
- clearInterval(intervalID) {
235
- utils.function.defer(clearTimer, this, intervalID);
236
- },
84
+ // reset timer
85
+ event.on(event.STATE_RESUME, () => {
86
+ this.reset();
87
+ });
88
+ event.on(event.STATE_RESTART, () => {
89
+ this.reset();
90
+ });
91
+ event.on(event.STATE_CHANGE, () => {
92
+ this.reset();
93
+ });
94
+ }
237
95
 
238
- /**
239
- * Return the current timestamp in milliseconds <br>
240
- * since the game has started or since linux epoch (based on browser support for High Resolution Timer)
241
- * @name getTime
242
- * @memberof timer
243
- * @returns {number}
244
- * @function
245
- */
246
- getTime() {
247
- return now;
248
- },
249
96
 
250
- /**
251
- * Return elapsed time in milliseconds since the last update
252
- * @name getDelta
253
- * @memberof timer
254
- * @returns {number}
255
- * @function
256
- */
257
- getDelta() {
258
- return delta;
259
- },
97
+ /**
98
+ * reset time (e.g. usefull in case of pause)
99
+ * @name reset
100
+ * @memberof timer
101
+ * @ignore
102
+ */
103
+ reset() {
104
+ // set to "now"
105
+ this.last = this.now = globalThis.performance.now();
106
+ this.delta = 0;
107
+ // reset delta counting variables
108
+ this.framedelta = 0;
109
+ this.framecount = 0;
110
+ this.step = Math.ceil(1000 / this.maxfps); // ROUND IT ?
111
+ // define some step with some margin
112
+ this.minstep = (1000 / this.maxfps) * 1.25; // IS IT NECESSARY?\
113
+ }
260
114
 
261
- /**
262
- * compute the actual frame time and fps rate
263
- * @name computeFPS
264
- * @ignore
265
- * @memberof timer
266
- * @function
267
- */
268
- countFPS() {
269
- framecount++;
270
- framedelta += delta;
271
- if (framecount % 10 === 0) {
272
- this.fps = clamp(Math.round((1000 * framecount) / framedelta), 0, this.maxfps);
273
- framedelta = 0;
274
- framecount = 0;
115
+ /**
116
+ * Calls a function once after a specified delay. See me.timer.setInterval to repeativly call a function.
117
+ * @name setTimeout
118
+ * @memberof timer
119
+ * @param {Function} fn the function you want to execute after delay milliseconds.
120
+ * @param {number} delay the number of milliseconds (thousandths of a second) that the function call should be delayed by.
121
+ * @param {boolean} [pauseable=true] respects the pause state of the engine.
122
+ * @param {...*} args optional parameters which are passed through to the function specified by fn once the timer expires.
123
+ * @returns {number} The numerical ID of the timer, which can be used later with me.timer.clearTimeout().
124
+ * @example
125
+ * // set a timer to call "myFunction" after 1000ms
126
+ * me.timer.setTimeout(myFunction, 1000);
127
+ * // set a timer to call "myFunction" after 1000ms (respecting the pause state) and passing param1 and param2
128
+ * me.timer.setTimeout(myFunction, 1000, true, param1, param2);
129
+ */
130
+ setTimeout(fn, delay, pauseable, ...args) {
131
+ this.timers.push({
132
+ fn : fn,
133
+ delay : delay,
134
+ elapsed : 0,
135
+ repeat : false,
136
+ timerId : ++this.timerId,
137
+ pauseable : pauseable === true || true,
138
+ args : args
139
+ });
140
+ return this.timerId;
141
+ }
142
+
143
+ /**
144
+ * Calls a function continously at the specified interval. See setTimeout to call function a single time.
145
+ * @name setInterval
146
+ * @memberof timer
147
+ * @param {Function} fn the function to execute
148
+ * @param {number} delay the number of milliseconds (thousandths of a second) on how often to execute the function
149
+ * @param {boolean} [pauseable=true] respects the pause state of the engine.
150
+ * @param {...*} args optional parameters which are passed through to the function specified by fn once the timer expires.
151
+ * @returns {number} The numerical ID of the timer, which can be used later with me.timer.clearInterval().
152
+ * @example
153
+ * // set a timer to call "myFunction" every 1000ms
154
+ * me.timer.setInterval(myFunction, 1000);
155
+ * // set a timer to call "myFunction" every 1000ms (respecting the pause state) and passing param1 and param2
156
+ * me.timer.setInterval(myFunction, 1000, true, param1, param2);
157
+ */
158
+ setInterval(fn, delay, pauseable, ...args) {
159
+ this.timers.push({
160
+ fn : fn,
161
+ delay : delay,
162
+ elapsed : 0,
163
+ repeat : true,
164
+ timerId : ++this.timerId,
165
+ pauseable : pauseable === true || true,
166
+ args : args
167
+ });
168
+ return this.timerId;
169
+ }
170
+
171
+ /**
172
+ * Clears the delay set by me.timer.setTimeout().
173
+ * @name clearTimeout
174
+ * @memberof timer
175
+ * @param {number} timeoutID ID of the timeout to be cleared
176
+ */
177
+ clearTimeout(timeoutID) {
178
+ utils.function.defer(this.clearTimer.bind(this), this, timeoutID);
179
+ }
180
+
181
+ /**
182
+ * Clears the Interval set by me.timer.setInterval().
183
+ * @name clearInterval
184
+ * @memberof timer
185
+ * @param {number} intervalID ID of the interval to be cleared
186
+ */
187
+ clearInterval(intervalID) {
188
+ utils.function.defer(this.clearTimer.bind(this), this, intervalID);
189
+ }
190
+
191
+ /**
192
+ * Return the current timestamp in milliseconds <br>
193
+ * since the game has started or since linux epoch (based on browser support for High Resolution Timer)
194
+ * @name getTime
195
+ * @memberof timer
196
+ * @returns {number}
197
+ */
198
+ getTime() {
199
+ return this.now;
200
+ }
201
+
202
+ /**
203
+ * Return elapsed time in milliseconds since the last update
204
+ * @name getDelta
205
+ * @memberof timer
206
+ * @returns {number}
207
+ */
208
+ getDelta() {
209
+ return this.delta;
210
+ }
211
+
212
+ /**
213
+ * compute the actual frame time and fps rate
214
+ * @name computeFPS
215
+ * @ignore
216
+ * @memberof timer
217
+ */
218
+ countFPS() {
219
+ this.framecount++;
220
+ this.framedelta += this.delta;
221
+ if (this.framecount % 10 === 0) {
222
+ this.fps = clamp(Math.round((1000 * this.framecount) / this.framedelta), 0, this.maxfps);
223
+ this.framedelta = 0;
224
+ this.framecount = 0;
225
+ }
226
+ }
227
+
228
+ /**
229
+ * update
230
+ * @ignore
231
+ */
232
+ update(time) {
233
+ this.last = this.now;
234
+ this.now = time;
235
+ this.delta = (this.now - this.last);
236
+
237
+ // fix for negative timestamp returned by wechat or chrome on startup
238
+ if (this.delta < 0) {
239
+ this.delta = 0;
240
+ }
241
+
242
+ // get the game tick
243
+ this.tick = (this.delta > this.minstep && this.interpolation) ? this.delta / this.step : 1;
244
+
245
+ this.updateTimers();
246
+ }
247
+
248
+ /**
249
+ * clear Timers
250
+ * @ignore
251
+ */
252
+ clearTimer(timerId) {
253
+ for (var i = 0, len = this.timers.length; i < len; i++) {
254
+ if (this.timers[i].timerId === timerId) {
255
+ this.timers.splice(i, 1);
256
+ break;
275
257
  }
276
258
  }
259
+ }
260
+
261
+
262
+ /**
263
+ * update timers
264
+ * @ignore
265
+ */
266
+ updateTimers() {
267
+ for (var i = 0, len = this.timers.length; i < len; i++) {
268
+ var _timer = this.timers[i];
269
+ if (!(_timer.pauseable && state.isPaused())) {
270
+ _timer.elapsed += this.delta;
271
+ }
272
+ if (_timer.elapsed >= _timer.delay) {
273
+ _timer.fn.apply(null, _timer.args);
274
+ if (_timer.repeat === true) {
275
+ _timer.elapsed -= _timer.delay;
276
+ } else {
277
+ this.clearTimeout(_timer.timerId);
278
+ }
279
+ }
280
+ }
281
+ }
277
282
  };
278
283
 
284
+ /**
285
+ * the default global Timer instance
286
+ * @namespace timer
287
+ * @see Timer
288
+ * @example
289
+ * // set a timer to call "myFunction" after 1000ms
290
+ * timer.setTimeout(myFunction, 1000);
291
+ * // set a timer to call "myFunction" after 1000ms (respecting the pause state) and passing param1 and param2
292
+ * timer.setTimeout(myFunction, 1000, true, param1, param2);
293
+ * // set a timer to call "myFunction" every 1000ms
294
+ * timer.setInterval(myFunction, 1000);
295
+ * // set a timer to call "myFunction" every 1000ms (respecting the pause state) and passing param1 and param2
296
+ * timer.setInterval(myFunction, 1000, true, param1, param2);
297
+ */
298
+ const timer = new Timer();
299
+
279
300
  export default timer;
@@ -1,7 +1,7 @@
1
1
  import Glyph from "./glyph.js";
2
2
 
3
3
  // bitmap constants
4
- var capChars = ["M", "N", "B", "D", "C", "E", "F", "K", "A", "G", "H", "I", "J", "L", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"];
4
+ const capChars = ["M", "N", "B", "D", "C", "E", "F", "K", "A", "G", "H", "I", "J", "L", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"];
5
5
 
6
6
  /**
7
7
  * Gets the value from a string of pairs.
@@ -21,7 +21,6 @@ function getValueFromPair(string, pattern) {
21
21
  * @ignore
22
22
  * @name _getFirstGlyph
23
23
  * @memberof BitmapTextData
24
- * @function
25
24
  * @param {object} glyphs the map of glyphs, each key is a char code
26
25
  * @returns {Glyph}
27
26
  */
@@ -40,7 +39,6 @@ function getFirstGlyph(glyphs) {
40
39
  * @ignore
41
40
  * @name createSpaceGlyph
42
41
  * @memberof BitmapTextData
43
- * @function
44
42
  * @param {object} glyphs the map of glyphs, each key is a char code
45
43
  */
46
44
  function createSpaceGlyph(glyphs) {
@@ -100,7 +98,6 @@ class BitmapTextData {
100
98
  * This parses the font data text and builds a map of glyphs containing the data for each character
101
99
  * @name parse
102
100
  * @memberof BitmapTextData
103
- * @function
104
101
  * @param {string} fontData
105
102
  */
106
103
  parse(fontData) {
package/src/text/glyph.js CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
2
  // bitmap constants
3
- var LOG2_PAGE_SIZE = 9;
4
- var PAGE_SIZE = 1 << LOG2_PAGE_SIZE;
3
+ const LOG2_PAGE_SIZE = 9;
4
+ const PAGE_SIZE = 1 << LOG2_PAGE_SIZE;
5
5
 
6
6
  /**
7
7
  * a glyph representing a single character in a font
package/src/text/text.js CHANGED
@@ -17,8 +17,8 @@ import TextMetrics from "./textmetrics.js";
17
17
  */
18
18
 
19
19
 
20
- var runits = ["ex", "em", "pt", "px"];
21
- var toPX = [12, 24, 0.75, 1];
20
+ const runits = ["ex", "em", "pt", "px"];
21
+ const toPX = [12, 24, 0.75, 1];
22
22
 
23
23
  // return a valid 2d context for Text rendering/styling
24
24
  var getContext2d = function (renderer, text) {
@@ -66,7 +66,8 @@ class Text extends Renderable {
66
66
  /**
67
67
  * defines the color used to draw the font.<br>
68
68
  * @public
69
- * @type {Color}
69
+ * @member {Color}
70
+ * @name Text#fillStyle
70
71
  * @default black
71
72
  */
72
73
  if (typeof settings.fillStyle !== "undefined") {
@@ -83,7 +84,8 @@ class Text extends Renderable {
83
84
  /**
84
85
  * defines the color used to draw the font stroke.<br>
85
86
  * @public
86
- * @type {Color}
87
+ * @member {Color}
88
+ * @name strokeStyle
87
89
  * @default black
88
90
  */
89
91
  if (typeof settings.strokeStyle !== "undefined") {
@@ -190,7 +192,7 @@ class Text extends Renderable {
190
192
 
191
193
  if (settings.offScreenCanvas === true) {
192
194
  this.offScreenCanvas = true;
193
- this.canvasTexture = pool.pull("CanvasTexture", 2, 2, true);
195
+ this.canvasTexture = pool.pull("CanvasTexture", 2, 2, { offscreenCanvas: true });
194
196
  }
195
197
 
196
198
  // instance to text metrics functions
@@ -1,10 +1,8 @@
1
1
  import Bounds from "./../physics/bounds.js";
2
2
  import { trimRight } from "./../utils/string.js";
3
3
  import Text from "./text.js";
4
- //import BitmapText from "./bitmaptext.js";
5
4
  import setContextStyle from "./textstyle.js";
6
5
 
7
-
8
6
  /**
9
7
  * @classdesc
10
8
  * a Text Metrics object that contains helper for text manipulation
@@ -1,4 +1,4 @@
1
- /**
1
+ /*
2
2
  * Tween.js - Licensed under the MIT license
3
3
  * https://github.com/tweenjs/tween.js
4
4
  */
@@ -1,4 +1,4 @@
1
- /**
1
+ /*
2
2
  * Tween.js - Licensed under the MIT license
3
3
  * https://github.com/tweenjs/tween.js
4
4
  */
@@ -76,7 +76,7 @@ export let Interpolation = {
76
76
  return fc( n ) / fc( i ) / fc( n - i );
77
77
 
78
78
  },
79
- /** @ignore */
79
+ /* @ignore */
80
80
  Factorial: ( function () {
81
81
 
82
82
  var a = [ 1 ];