melonjs 10.2.3 → 10.5.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 (96) hide show
  1. package/README.md +6 -6
  2. package/dist/melonjs.js +3620 -3582
  3. package/dist/melonjs.min.js +5 -5
  4. package/dist/melonjs.module.d.ts +3646 -4545
  5. package/dist/melonjs.module.js +3912 -3521
  6. package/package.json +21 -20
  7. package/src/audio/audio.js +30 -31
  8. package/src/camera/camera2d.js +47 -58
  9. package/src/entity/entity.js +32 -38
  10. package/src/game.js +21 -22
  11. package/src/{shapes → geometries}/ellipse.js +40 -47
  12. package/src/{shapes → geometries}/line.js +9 -12
  13. package/src/{shapes → geometries}/poly.js +100 -53
  14. package/src/{shapes → geometries}/rectangle.js +42 -45
  15. package/src/index.js +14 -32
  16. package/src/input/gamepad.js +11 -10
  17. package/src/input/input.js +2 -3
  18. package/src/input/keyboard.js +113 -113
  19. package/src/input/pointer.js +61 -29
  20. package/src/input/pointerevent.js +92 -29
  21. package/src/lang/deprecated.js +83 -13
  22. package/src/level/level.js +23 -24
  23. package/src/level/tiled/TMXGroup.js +7 -9
  24. package/src/level/tiled/TMXLayer.js +30 -33
  25. package/src/level/tiled/TMXObject.js +59 -53
  26. package/src/level/tiled/TMXTile.js +18 -19
  27. package/src/level/tiled/TMXTileMap.js +40 -46
  28. package/src/level/tiled/TMXTileset.js +12 -16
  29. package/src/level/tiled/TMXTilesetGroup.js +9 -10
  30. package/src/level/tiled/renderer/TMXHexagonalRenderer.js +7 -9
  31. package/src/level/tiled/renderer/TMXIsometricRenderer.js +7 -9
  32. package/src/level/tiled/renderer/TMXOrthogonalRenderer.js +4 -6
  33. package/src/level/tiled/renderer/TMXRenderer.js +24 -26
  34. package/src/level/tiled/renderer/TMXStaggeredRenderer.js +1 -5
  35. package/src/loader/loader.js +17 -16
  36. package/src/loader/loadingscreen.js +2 -5
  37. package/src/math/color.js +47 -67
  38. package/src/math/math.js +15 -16
  39. package/src/math/matrix2.js +53 -59
  40. package/src/math/matrix3.js +56 -63
  41. package/src/math/observable_vector2.js +87 -77
  42. package/src/math/observable_vector3.js +97 -80
  43. package/src/math/vector2.js +107 -97
  44. package/src/math/vector3.js +116 -100
  45. package/src/particles/emitter.js +66 -76
  46. package/src/particles/particle.js +4 -6
  47. package/src/particles/particlecontainer.js +2 -4
  48. package/src/physics/body.js +49 -147
  49. package/src/physics/bounds.js +48 -50
  50. package/src/physics/collision.js +13 -14
  51. package/src/physics/detector.js +18 -17
  52. package/src/physics/quadtree.js +17 -20
  53. package/src/physics/sat.js +30 -30
  54. package/src/physics/world.js +24 -29
  55. package/src/plugin/plugin.js +11 -15
  56. package/src/renderable/GUI.js +41 -47
  57. package/src/renderable/collectable.js +5 -10
  58. package/src/renderable/colorlayer.js +10 -15
  59. package/src/renderable/container.js +87 -73
  60. package/src/renderable/dragndrop.js +224 -0
  61. package/src/renderable/imagelayer.js +25 -32
  62. package/src/renderable/nineslicesprite.js +41 -42
  63. package/src/renderable/renderable.js +113 -124
  64. package/src/renderable/sprite.js +62 -69
  65. package/src/renderable/trigger.js +26 -32
  66. package/src/state/stage.js +13 -18
  67. package/src/state/state.js +26 -27
  68. package/src/system/device.js +76 -133
  69. package/src/system/event.js +81 -70
  70. package/src/system/pooling.js +11 -12
  71. package/src/system/save.js +3 -4
  72. package/src/system/timer.js +19 -20
  73. package/src/text/bitmaptext.js +57 -55
  74. package/src/text/bitmaptextdata.js +10 -11
  75. package/src/text/glyph.js +3 -0
  76. package/src/text/text.js +49 -55
  77. package/src/tweens/easing.js +1 -1
  78. package/src/tweens/interpolation.js +1 -1
  79. package/src/tweens/tween.js +44 -46
  80. package/src/utils/agent.js +3 -4
  81. package/src/utils/array.js +4 -5
  82. package/src/utils/file.js +3 -4
  83. package/src/utils/function.js +4 -5
  84. package/src/utils/string.js +7 -9
  85. package/src/utils/utils.js +4 -5
  86. package/src/video/canvas/canvas_renderer.js +60 -62
  87. package/src/video/renderer.js +53 -58
  88. package/src/video/texture.js +98 -112
  89. package/src/video/texture_cache.js +26 -10
  90. package/src/video/video.js +15 -16
  91. package/src/video/webgl/buffer/vertex.js +2 -2
  92. package/src/video/webgl/glshader.js +37 -39
  93. package/src/video/webgl/webgl_compositor.js +128 -101
  94. package/src/video/webgl/webgl_renderer.js +126 -106
  95. package/src/entity/draggable.js +0 -139
  96. package/src/entity/droptarget.js +0 -109
@@ -34,41 +34,37 @@ var measureTextHeight = function(font) {
34
34
  /**
35
35
  * @classdesc
36
36
  * a bitmap font object
37
- * @class BitmapText
38
- * @extends me.Renderable
39
- * @memberOf me
40
- * @constructor
41
- * @param {number} x position of the text object
42
- * @param {number} y position of the text object
43
- * @param {object} settings the text configuration
44
- * @param {string|Image} settings.font a font name to identify the corresponing source image
45
- * @param {string} [settings.fontData=settings.font] the bitmap font data corresponding name, or the bitmap font data itself
46
- * @param {number} [settings.size] size a scaling ratio
47
- * @param {me.Color|string} [settings.fillStyle] a CSS color value used to tint the bitmapText (@see me.BitmapText.tint)
48
- * @param {number} [settings.lineWidth=1] line width, in pixels, when drawing stroke
49
- * @param {string} [settings.textAlign="left"] horizontal text alignment
50
- * @param {string} [settings.textBaseline="top"] the text baseline
51
- * @param {number} [settings.lineHeight=1.0] line spacing height
52
- * @param {me.Vector2d} [settings.anchorPoint={x:0.0, y:0.0}] anchor point to draw the text at
53
- * @param {(string|string[])} [settings.text] a string, or an array of strings
54
- * @example
55
- * // Use me.loader.preload or me.loader.load to load assets
56
- * me.loader.preload([
57
- * { name: "arial", type: "binary" src: "data/font/arial.fnt" },
58
- * { name: "arial", type: "image" src: "data/font/arial.png" },
59
- * ])
60
- * // Then create an instance of your bitmap font:
61
- * var myFont = new me.BitmapText(x, y, {font:"arial", text:"Hello"});
62
- * // two possibilities for using "myFont"
63
- * // either call the draw function from your Renderable draw function
64
- * myFont.draw(renderer, "Hello!", 0, 0);
65
- * // or just add it to the word container
66
- * me.game.world.addChild(myFont);
37
+ * @augments Renderable
67
38
  */
68
-
69
39
  class BitmapText extends Renderable {
70
-
71
- /** @ignore */
40
+ /**
41
+ * @param {number} x position of the text object
42
+ * @param {number} y position of the text object
43
+ * @param {object} settings the text configuration
44
+ * @param {string|Image} settings.font a font name to identify the corresponing source image
45
+ * @param {string} [settings.fontData=settings.font] the bitmap font data corresponding name, or the bitmap font data itself
46
+ * @param {number} [settings.size] size a scaling ratio
47
+ * @param {Color|string} [settings.fillStyle] a CSS color value used to tint the bitmapText (@see BitmapText.tint)
48
+ * @param {number} [settings.lineWidth=1] line width, in pixels, when drawing stroke
49
+ * @param {string} [settings.textAlign="left"] horizontal text alignment
50
+ * @param {string} [settings.textBaseline="top"] the text baseline
51
+ * @param {number} [settings.lineHeight=1.0] line spacing height
52
+ * @param {Vector2d} [settings.anchorPoint={x:0.0, y:0.0}] anchor point to draw the text at
53
+ * @param {(string|string[])} [settings.text] a string, or an array of strings
54
+ * @example
55
+ * // Use me.loader.preload or me.loader.load to load assets
56
+ * me.loader.preload([
57
+ * { name: "arial", type: "binary" src: "data/font/arial.fnt" },
58
+ * { name: "arial", type: "image" src: "data/font/arial.png" },
59
+ * ])
60
+ * // Then create an instance of your bitmap font:
61
+ * var myFont = new me.BitmapText(x, y, {font:"arial", text:"Hello"});
62
+ * // two possibilities for using "myFont"
63
+ * // either call the draw function from your Renderable draw function
64
+ * myFont.draw(renderer, "Hello!", 0, 0);
65
+ * // or just add it to the word container
66
+ * me.game.world.addChild(myFont);
67
+ */
72
68
  constructor(x, y, settings) {
73
69
  // call the parent constructor
74
70
  super(x, y, settings.width || 0, settings.height || 0);
@@ -80,7 +76,7 @@ class BitmapText extends Renderable {
80
76
  * @type {string}
81
77
  * @default "left"
82
78
  * @name textAlign
83
- * @memberOf me.BitmapText
79
+ * @memberof BitmapText
84
80
  */
85
81
  this.textAlign = settings.textAlign || "left";
86
82
 
@@ -91,7 +87,7 @@ class BitmapText extends Renderable {
91
87
  * @type {string}
92
88
  * @default "top"
93
89
  * @name textBaseline
94
- * @memberOf me.BitmapText
90
+ * @memberof BitmapText
95
91
  */
96
92
  this.textBaseline = settings.textBaseline || "top";
97
93
 
@@ -102,27 +98,33 @@ class BitmapText extends Renderable {
102
98
  * @type {number}
103
99
  * @default 1.0
104
100
  * @name lineHeight
105
- * @memberOf me.BitmapText
101
+ * @memberof BitmapText
106
102
  */
107
103
  this.lineHeight = settings.lineHeight || 1.0;
108
104
 
109
105
  /**
110
106
  * the text to be displayed
111
107
  * @private
112
- * @type {string[]}
113
- * @name _text
114
- * @memberOf me.BitmapText
115
108
  */
116
109
  this._text = [];
117
110
 
118
- /** @ignore */
119
- // scaled font size;
111
+ /**
112
+ * scaled font size
113
+ * @private
114
+ */
120
115
  this.fontScale = pool.pull("Vector2d", 1.0, 1.0);
121
116
 
122
- // get the corresponding image
117
+ /**
118
+ * font image
119
+ * @private
120
+ */
123
121
  this.fontImage = (typeof settings.font === "object") ? settings.font : loader.getImage(settings.font);
124
122
 
125
123
  if (typeof settings.fontData !== "string") {
124
+ /**
125
+ * font data
126
+ * @private
127
+ */
126
128
  // use settings.font to retreive the data from the loader
127
129
  this.fontData = pool.pull("BitmapTextData", loader.getBinary(settings.font));
128
130
  } else {
@@ -166,11 +168,11 @@ class BitmapText extends Renderable {
166
168
  /**
167
169
  * change the font settings
168
170
  * @name set
169
- * @memberOf me.BitmapText.prototype
171
+ * @memberof BitmapText.prototype
170
172
  * @function
171
173
  * @param {string} textAlign ("left", "center", "right")
172
174
  * @param {number} [scale]
173
- * @returns {me.BitmapText} this object for chaining
175
+ * @returns {BitmapText} this object for chaining
174
176
  */
175
177
  set(textAlign, scale) {
176
178
  this.textAlign = textAlign;
@@ -186,10 +188,10 @@ class BitmapText extends Renderable {
186
188
  /**
187
189
  * change the text to be displayed
188
190
  * @name setText
189
- * @memberOf me.BitmapText.prototype
191
+ * @memberof BitmapText.prototype
190
192
  * @function
191
193
  * @param {number|string|string[]} value a string, or an array of strings
192
- * @returns {me.BitmapText} this object for chaining
194
+ * @returns {BitmapText} this object for chaining
193
195
  */
194
196
  setText(value) {
195
197
  if (typeof value === "undefined") {
@@ -211,10 +213,10 @@ class BitmapText extends Renderable {
211
213
  /**
212
214
  * defines the color used to tint the bitmap text
213
215
  * @public
214
- * @type {me.Color}
216
+ * @type {Color}
215
217
  * @name fillStyle
216
- * @see me.Renderable#tint
217
- * @memberOf me.BitmapText
218
+ * @see Renderable#tint
219
+ * @memberof BitmapText
218
220
  */
219
221
  get fillStyle() {
220
222
  return this.tint;
@@ -226,10 +228,10 @@ class BitmapText extends Renderable {
226
228
  /**
227
229
  * change the font display size
228
230
  * @name resize
229
- * @memberOf me.BitmapText.prototype
231
+ * @memberof BitmapText.prototype
230
232
  * @function
231
233
  * @param {number} scale ratio
232
- * @returns {me.BitmapText} this object for chaining
234
+ * @returns {BitmapText} this object for chaining
233
235
  */
234
236
  resize(scale) {
235
237
  this.fontScale.set(scale, scale);
@@ -242,10 +244,10 @@ class BitmapText extends Renderable {
242
244
  /**
243
245
  * measure the given text size in pixels
244
246
  * @name measureText
245
- * @memberOf me.BitmapText.prototype
247
+ * @memberof BitmapText.prototype
246
248
  * @function
247
249
  * @param {string} [text]
248
- * @param {me.Rect} [ret] a object in which to store the text metrics
250
+ * @param {Rect} [ret] a object in which to store the text metrics
249
251
  * @returns {TextMetrics} a TextMetrics object with two properties: `width` and `height`, defining the output dimensions
250
252
  */
251
253
  measureText(text, ret) {
@@ -277,9 +279,9 @@ class BitmapText extends Renderable {
277
279
  /**
278
280
  * draw the bitmap font
279
281
  * @name draw
280
- * @memberOf me.BitmapText.prototype
282
+ * @memberof BitmapText.prototype
281
283
  * @function
282
- * @param {me.CanvasRenderer|me.WebGLRenderer} renderer Reference to the destination renderer instance
284
+ * @param {CanvasRenderer|WebGLRenderer} renderer Reference to the destination renderer instance
283
285
  * @param {string} [text]
284
286
  * @param {number} [x]
285
287
  * @param {number} [y]
@@ -20,10 +20,10 @@ function getValueFromPair(string, pattern) {
20
20
  * Gets the first glyph in the map that is not a space character
21
21
  * @ignore
22
22
  * @name _getFirstGlyph
23
- * @memberOf me.BitmapTextData
23
+ * @memberof BitmapTextData
24
24
  * @function
25
25
  * @param {object} glyphs the map of glyphs, each key is a char code
26
- * @returns {me.Glyph}
26
+ * @returns {Glyph}
27
27
  */
28
28
  function getFirstGlyph(glyphs) {
29
29
  var keys = Object.keys(glyphs);
@@ -39,7 +39,7 @@ function getFirstGlyph(glyphs) {
39
39
  * Creates a glyph to use for the space character
40
40
  * @ignore
41
41
  * @name createSpaceGlyph
42
- * @memberOf me.BitmapTextData
42
+ * @memberof BitmapTextData
43
43
  * @function
44
44
  * @param {object} glyphs the map of glyphs, each key is a char code
45
45
  */
@@ -58,16 +58,15 @@ function createSpaceGlyph(glyphs) {
58
58
 
59
59
  /**
60
60
  * Class for storing relevant data from the font file.
61
- * @class me.BitmapTextData
62
- * @memberOf me
63
61
  * @ignore
64
- * @param data {string} - The bitmap font data pulled from the resource loader using me.loader.getBinary()
65
- * @constructor
66
62
  */
67
63
  class BitmapTextData {
68
64
 
69
- constructor(...args) {
70
- this.onResetEvent(...args);
65
+ /**
66
+ * @param {string} data - The bitmap font data pulled from the resource loader using me.loader.getBinary()
67
+ */
68
+ constructor(data) {
69
+ this.onResetEvent(data);
71
70
  }
72
71
 
73
72
  /**
@@ -89,7 +88,7 @@ class BitmapTextData {
89
88
  * The map of glyphs, each key is a char code.
90
89
  * @name glyphs
91
90
  * @type {object}
92
- * @memberOf me.BitmapTextData
91
+ * @memberof BitmapTextData
93
92
  */
94
93
  this.glyphs = {};
95
94
 
@@ -100,7 +99,7 @@ class BitmapTextData {
100
99
  /**
101
100
  * This parses the font data text and builds a map of glyphs containing the data for each character
102
101
  * @name parse
103
- * @memberOf me.BitmapTextData
102
+ * @memberof BitmapTextData
104
103
  * @function
105
104
  * @param {string} fontData
106
105
  */
package/src/text/glyph.js CHANGED
@@ -8,6 +8,9 @@ var PAGE_SIZE = 1 << LOG2_PAGE_SIZE;
8
8
  * @ignore
9
9
  */
10
10
  class Glyph {
11
+ /**
12
+ * @ignore
13
+ */
11
14
  constructor() {
12
15
  this.id = 0;
13
16
  this.x = 0;
package/src/text/text.js CHANGED
@@ -37,30 +37,27 @@ var setContextStyle = function(context, font, stroke = false) {
37
37
  /**
38
38
  * @classdesc
39
39
  * a generic system font object.
40
- * @class Text
41
- * @extends me.Renderable
42
- * @memberOf me
43
- * @constructor
44
- * @param {number} x position of the text object
45
- * @param {number} y position of the text object
46
- * @param {object} settings the text configuration
47
- * @param {string} settings.font a CSS family font name
48
- * @param {number|string} settings.size size, or size + suffix (px, em, pt)
49
- * @param {me.Color|string} [settings.fillStyle="#000000"] a CSS color value
50
- * @param {me.Color|string} [settings.strokeStyle="#000000"] a CSS color value
51
- * @param {number} [settings.lineWidth=1] line width, in pixels, when drawing stroke
52
- * @param {string} [settings.textAlign="left"] horizontal text alignment
53
- * @param {string} [settings.textBaseline="top"] the text baseline
54
- * @param {number} [settings.lineHeight=1.0] line spacing height
55
- * @param {me.Vector2d} [settings.anchorPoint={x:0.0, y:0.0}] anchor point to draw the text at
56
- * @param {boolean} [settings.offScreenCanvas=false] whether to draw the font to an individual "cache" texture first
57
- * @param {(string|string[])} [settings.text=""] a string, or an array of strings
58
- * @example
59
- * var font = new me.Text(0, 0, {font: "Arial", size: 8, fillStyle: this.color});
40
+ * @augments Renderable
60
41
  */
61
42
  class Text extends Renderable {
62
-
63
- /** @ignore */
43
+ /**
44
+ * @param {number} x position of the text object
45
+ * @param {number} y position of the text object
46
+ * @param {object} settings the text configuration
47
+ * @param {string} settings.font a CSS family font name
48
+ * @param {number|string} settings.size size, or size + suffix (px, em, pt)
49
+ * @param {Color|string} [settings.fillStyle="#000000"] a CSS color value
50
+ * @param {Color|string} [settings.strokeStyle="#000000"] a CSS color value
51
+ * @param {number} [settings.lineWidth=1] line width, in pixels, when drawing stroke
52
+ * @param {string} [settings.textAlign="left"] horizontal text alignment
53
+ * @param {string} [settings.textBaseline="top"] the text baseline
54
+ * @param {number} [settings.lineHeight=1.0] line spacing height
55
+ * @param {Vector2d} [settings.anchorPoint={x:0.0, y:0.0}] anchor point to draw the text at
56
+ * @param {boolean} [settings.offScreenCanvas=false] whether to draw the font to an individual "cache" texture first
57
+ * @param {(string|string[])} [settings.text=""] a string, or an array of strings
58
+ * @example
59
+ * var font = new me.Text(0, 0, {font: "Arial", size: 8, fillStyle: this.color});
60
+ */
64
61
  constructor(x, y, settings) {
65
62
  // call the parent constructor
66
63
  super(x, y, settings.width || 0, settings.height || 0);
@@ -73,9 +70,9 @@ class Text extends Renderable {
73
70
  /**
74
71
  * defines the color used to draw the font.<br>
75
72
  * @public
76
- * @type {me.Color}
73
+ * @type {Color}
77
74
  * @default black
78
- * @name me.Text#fillStyle
75
+ * @name Text#fillStyle
79
76
  */
80
77
  if (typeof settings.fillStyle !== "undefined") {
81
78
  if (settings.fillStyle instanceof Color) {
@@ -91,9 +88,9 @@ class Text extends Renderable {
91
88
  /**
92
89
  * defines the color used to draw the font stroke.<br>
93
90
  * @public
94
- * @type {me.Color}
91
+ * @type {Color}
95
92
  * @default black
96
- * @name me.Text#strokeStyle
93
+ * @name Text#strokeStyle
97
94
  */
98
95
  if (typeof settings.strokeStyle !== "undefined") {
99
96
  if (settings.strokeStyle instanceof Color) {
@@ -111,7 +108,7 @@ class Text extends Renderable {
111
108
  * @public
112
109
  * @type {number}
113
110
  * @default 1
114
- * @name me.Text#lineWidth
111
+ * @name Text#lineWidth
115
112
  */
116
113
  this.lineWidth = settings.lineWidth || 1;
117
114
 
@@ -121,7 +118,7 @@ class Text extends Renderable {
121
118
  * @public
122
119
  * @type {string}
123
120
  * @default "left"
124
- * @name me.Text#textAlign
121
+ * @name Text#textAlign
125
122
  */
126
123
  this.textAlign = settings.textAlign || "left";
127
124
 
@@ -131,7 +128,7 @@ class Text extends Renderable {
131
128
  * @public
132
129
  * @type {string}
133
130
  * @default "top"
134
- * @name me.Text#textBaseline
131
+ * @name Text#textBaseline
135
132
  */
136
133
  this.textBaseline = settings.textBaseline || "top";
137
134
 
@@ -141,7 +138,7 @@ class Text extends Renderable {
141
138
  * @public
142
139
  * @type {number}
143
140
  * @default 1.0
144
- * @name me.Text#lineHeight
141
+ * @name Text#lineHeight
145
142
  */
146
143
  this.lineHeight = settings.lineHeight || 1.0;
147
144
 
@@ -152,16 +149,13 @@ class Text extends Renderable {
152
149
  * @public
153
150
  * @type {boolean}
154
151
  * @default false
155
- * @name me.Text#offScreenCanvas
152
+ * @name Text#offScreenCanvas
156
153
  */
157
154
  this.offScreenCanvas = false;
158
155
 
159
156
  /**
160
157
  * the text to be displayed
161
158
  * @private
162
- * @type {string[]}
163
- * @name _text
164
- * @memberOf me.Text
165
159
  */
166
160
  this._text = [];
167
161
 
@@ -171,7 +165,7 @@ class Text extends Renderable {
171
165
  * @type {number}
172
166
  * @name fontSize
173
167
  * @default 10
174
- * @memberOf me.Text
168
+ * @memberof Text
175
169
  */
176
170
  this.fontSize = 10;
177
171
 
@@ -215,22 +209,21 @@ class Text extends Renderable {
215
209
  onDeactivateEvent() {
216
210
  // free the canvas and potential corresponding texture when deactivated
217
211
  if (this.offScreenCanvas === true) {
218
- if (renderer instanceof WebGLRenderer) {
219
- renderer.currentCompositor.unbindTexture2D(renderer.cache.get(this.canvas));
220
- renderer.cache.remove(this.canvas);
221
- }
212
+ renderer.currentCompositor.deleteTexture2D(renderer.currentCompositor.getTexture2D(this.glTextureUnit));
213
+ renderer.cache.delete(this.canvas);
222
214
  this.canvas.width = this.canvas.height = 0;
223
215
  this.context = undefined;
224
216
  this.canvas = undefined;
217
+ this.glTextureUnit = undefined;
225
218
  }
226
219
  }
227
220
 
228
221
  /**
229
222
  * make the font bold
230
223
  * @name bold
231
- * @memberOf me.Text.prototype
224
+ * @memberof Text.prototype
232
225
  * @function
233
- * @returns {me.Text} this object for chaining
226
+ * @returns {Text} this object for chaining
234
227
  */
235
228
  bold() {
236
229
  this.font = "bold " + this.font;
@@ -241,9 +234,9 @@ class Text extends Renderable {
241
234
  /**
242
235
  * make the font italic
243
236
  * @name italic
244
- * @memberOf me.Text.prototype
237
+ * @memberof Text.prototype
245
238
  * @function
246
- * @returns {me.Text} this object for chaining
239
+ * @returns {Text} this object for chaining
247
240
  */
248
241
  italic() {
249
242
  this.font = "italic " + this.font;
@@ -254,11 +247,11 @@ class Text extends Renderable {
254
247
  /**
255
248
  * set the font family and size
256
249
  * @name setFont
257
- * @memberOf me.Text.prototype
250
+ * @memberof Text.prototype
258
251
  * @function
259
252
  * @param {string} font a CSS font name
260
253
  * @param {number|string} [size=10] size in px, or size + suffix (px, em, pt)
261
- * @returns {me.Text} this object for chaining
254
+ * @returns {Text} this object for chaining
262
255
  * @example
263
256
  * font.setFont("Arial", 20);
264
257
  * font.setFont("Arial", "1.5em");
@@ -298,10 +291,10 @@ class Text extends Renderable {
298
291
  /**
299
292
  * change the text to be displayed
300
293
  * @name setText
301
- * @memberOf me.Text.prototype
294
+ * @memberof Text.prototype
302
295
  * @function
303
296
  * @param {number|string|string[]} value a string, or an array of strings
304
- * @returns {me.Text} this object for chaining
297
+ * @returns {Text} this object for chaining
305
298
  */
306
299
  setText(value = "") {
307
300
  if (this._text.toString() !== value.toString()) {
@@ -319,11 +312,11 @@ class Text extends Renderable {
319
312
  /**
320
313
  * measure the given text size in pixels
321
314
  * @name measureText
322
- * @memberOf me.Text.prototype
315
+ * @memberof Text.prototype
323
316
  * @function
324
- * @param {me.CanvasRenderer|me.WebGLRenderer} [renderer] reference to the active renderer
317
+ * @param {CanvasRenderer|WebGLRenderer} [renderer] reference to the active renderer
325
318
  * @param {string} [text] the text to be measured
326
- * @param {me.Rect|me.Bounds} [ret] a object in which to store the text metrics
319
+ * @param {Rect|Bounds} [ret] a object in which to store the text metrics
327
320
  * @returns {TextMetrics} a TextMetrics object with two properties: `width` and `height`, defining the output dimensions
328
321
  */
329
322
  measureText(renderer, text, ret) {
@@ -380,7 +373,8 @@ class Text extends Renderable {
380
373
 
381
374
  if (renderer instanceof WebGLRenderer) {
382
375
  // invalidate the previous corresponding texture so that it can reuploaded once changed
383
- renderer.currentCompositor.unbindTexture2D(renderer.cache.get(this.canvas));
376
+ this.glTextureUnit = renderer.cache.getUnit(renderer.cache.get(this.canvas));
377
+ renderer.currentCompositor.unbindTexture2D(null, this.glTextureUnit);
384
378
 
385
379
  if (renderer.WebGLVersion === 1) {
386
380
  // round size to next Pow2
@@ -407,9 +401,9 @@ class Text extends Renderable {
407
401
  /**
408
402
  * draw a text at the specified coord
409
403
  * @name draw
410
- * @memberOf me.Text.prototype
404
+ * @memberof Text.prototype
411
405
  * @function
412
- * @param {me.CanvasRenderer|me.WebGLRenderer} renderer Reference to the destination renderer instance
406
+ * @param {CanvasRenderer|WebGLRenderer} renderer Reference to the destination renderer instance
413
407
  * @param {string} [text]
414
408
  * @param {number} [x]
415
409
  * @param {number} [y]
@@ -473,9 +467,9 @@ class Text extends Renderable {
473
467
  * by the `lineWidth` and `fillStroke` properties. <br>
474
468
  * Note : using drawStroke is not recommended for performance reasons
475
469
  * @name drawStroke
476
- * @memberOf me.Text.prototype
470
+ * @memberof Text.prototype
477
471
  * @function
478
- * @param {me.CanvasRenderer|me.WebGLRenderer} renderer Reference to the destination renderer instance
472
+ * @param {CanvasRenderer|WebGLRenderer} renderer Reference to the destination renderer instance
479
473
  * @param {string} text
480
474
  * @param {number} x
481
475
  * @param {number} y
@@ -44,7 +44,7 @@
44
44
  * @constant
45
45
  * @enum {Function}
46
46
  * @name Easing
47
- * @memberOf me.Tween
47
+ * @memberof Tween
48
48
  */
49
49
  export let Easing = {
50
50
 
@@ -14,7 +14,7 @@
14
14
  * @constant
15
15
  * @enum {Function}
16
16
  * @name Interpolation
17
- * @memberOf me.Tween
17
+ * @memberof Tween
18
18
  */
19
19
  export let Interpolation = {
20
20
  /** @ignore */