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
@@ -10,32 +10,31 @@ import pool from "./../system/pooling.js";
10
10
  * (which means that all angles are less than 180 degrees), as described here below : <br>
11
11
  * <center><img src="images/convex_polygon.png"/></center><br>
12
12
  * A polygon's `winding` is clockwise iff its vertices (points) are declared turning to the right. The image above shows COUNTERCLOCKWISE winding.
13
- * @class Polygon
14
- * @memberOf me
15
- * @constructor
16
- * @param {number} x origin point of the Polygon
17
- * @param {number} y origin point of the Polygon
18
- * @param {me.Vector2d[]} points array of vector defining the Polygon
19
13
  */
20
14
 
21
15
  class Polygon {
22
16
 
17
+ /**
18
+ * @param {number} x origin point of the Polygon
19
+ * @param {number} y origin point of the Polygon
20
+ * @param {Vector2d[]} points array of vector defining the Polygon
21
+ */
23
22
  constructor(x, y, points) {
24
23
  /**
25
24
  * origin point of the Polygon
26
25
  * @public
27
- * @type {me.Vector2d}
26
+ * @type {Vector2d}
28
27
  * @name pos
29
- * @memberof me.Polygon#
28
+ * @memberof Polygon#
30
29
  */
31
30
  this.pos = new Vector2d();
32
31
 
33
32
  /**
34
33
  * The bounding rectangle for this shape
35
34
  * @ignore
36
- * @type {me.Bounds}
35
+ * @type {Bounds}
37
36
  * @name _bounds
38
- * @memberOf me.Polygon#
37
+ * @memberof Polygon#
39
38
  */
40
39
  this._bounds;
41
40
 
@@ -43,9 +42,9 @@ class Polygon {
43
42
  * Array of points defining the Polygon <br>
44
43
  * Note: If you manually change `points`, you **must** call `recalc`afterwards so that the changes get applied correctly.
45
44
  * @public
46
- * @type {me.Vector2d[]}
45
+ * @type {Vector2d[]}
47
46
  * @name points
48
- * @memberOf me.Polygon#
47
+ * @memberof Polygon#
49
48
  */
50
49
  this.points = [];
51
50
 
@@ -84,12 +83,12 @@ class Polygon {
84
83
  /**
85
84
  * set new value to the Polygon
86
85
  * @name setShape
87
- * @memberOf me.Polygon.prototype
86
+ * @memberof Polygon.prototype
88
87
  * @function
89
88
  * @param {number} x position of the Polygon
90
89
  * @param {number} y position of the Polygon
91
- * @param {me.Vector2d[]|number[]} points array of vector or vertice defining the Polygon
92
- * @returns {me.Polygon} this instance for objecf chaining
90
+ * @param {Vector2d[]|number[]} points array of vector or vertice defining the Polygon
91
+ * @returns {Polygon} this instance for objecf chaining
93
92
  */
94
93
  setShape(x, y, points) {
95
94
  this.pos.set(x, y);
@@ -100,10 +99,10 @@ class Polygon {
100
99
  /**
101
100
  * set the vertices defining this Polygon
102
101
  * @name setVertices
103
- * @memberOf me.Polygon.prototype
102
+ * @memberof Polygon.prototype
104
103
  * @function
105
- * @param {me.Vector2d[]} vertices array of vector or vertice defining the Polygon
106
- * @returns {me.Polygon} this instance for objecf chaining
104
+ * @param {Vector2d[]} vertices array of vector or vertice defining the Polygon
105
+ * @returns {Polygon} this instance for objecf chaining
107
106
  */
108
107
  setVertices(vertices) {
109
108
 
@@ -140,10 +139,10 @@ class Polygon {
140
139
  /**
141
140
  * apply the given transformation matrix to this Polygon
142
141
  * @name transform
143
- * @memberOf me.Polygon.prototype
142
+ * @memberof Polygon.prototype
144
143
  * @function
145
- * @param {me.Matrix2d} m the transformation matrix
146
- * @returns {me.Polygon} Reference to this object for method chaining
144
+ * @param {Matrix2d} m the transformation matrix
145
+ * @returns {Polygon} Reference to this object for method chaining
147
146
  */
148
147
  transform(m) {
149
148
  var points = this.points;
@@ -159,9 +158,9 @@ class Polygon {
159
158
  /**
160
159
  * apply an isometric projection to this shape
161
160
  * @name toIso
162
- * @memberOf me.Polygon.prototype
161
+ * @memberof Polygon.prototype
163
162
  * @function
164
- * @returns {me.Polygon} Reference to this object for method chaining
163
+ * @returns {Polygon} Reference to this object for method chaining
165
164
  */
166
165
  toIso() {
167
166
  return this.rotate(Math.PI / 4).scale(Math.SQRT2, Math.SQRT1_2);
@@ -170,9 +169,9 @@ class Polygon {
170
169
  /**
171
170
  * apply a 2d projection to this shape
172
171
  * @name to2d
173
- * @memberOf me.Polygon.prototype
172
+ * @memberof Polygon.prototype
174
173
  * @function
175
- * @returns {me.Polygon} Reference to this object for method chaining
174
+ * @returns {Polygon} Reference to this object for method chaining
176
175
  */
177
176
  to2d() {
178
177
  return this.scale(Math.SQRT1_2, Math.SQRT2).rotate(-Math.PI / 4);
@@ -181,11 +180,11 @@ class Polygon {
181
180
  /**
182
181
  * Rotate this Polygon (counter-clockwise) by the specified angle (in radians).
183
182
  * @name rotate
184
- * @memberOf me.Polygon.prototype
183
+ * @memberof Polygon.prototype
185
184
  * @function
186
185
  * @param {number} angle The angle to rotate (in radians)
187
- * @param {me.Vector2d|me.ObservableVector2d} [v] an optional point to rotate around
188
- * @returns {me.Polygon} Reference to this object for method chaining
186
+ * @param {Vector2d|ObservableVector2d} [v] an optional point to rotate around
187
+ * @returns {Polygon} Reference to this object for method chaining
189
188
  */
190
189
  rotate(angle, v) {
191
190
  if (angle !== 0) {
@@ -203,11 +202,11 @@ class Polygon {
203
202
  /**
204
203
  * Scale this Polygon by the given scalar.
205
204
  * @name scale
206
- * @memberOf me.Polygon.prototype
205
+ * @memberof Polygon.prototype
207
206
  * @function
208
207
  * @param {number} x
209
208
  * @param {number} [y=x]
210
- * @returns {me.Polygon} Reference to this object for method chaining
209
+ * @returns {Polygon} Reference to this object for method chaining
211
210
  */
212
211
  scale(x, y) {
213
212
  y = typeof (y) !== "undefined" ? y : x;
@@ -225,10 +224,10 @@ class Polygon {
225
224
  /**
226
225
  * Scale this Polygon by the given vector
227
226
  * @name scaleV
228
- * @memberOf me.Polygon.prototype
227
+ * @memberof Polygon.prototype
229
228
  * @function
230
- * @param {me.Vector2d} v
231
- * @returns {me.Polygon} Reference to this object for method chaining
229
+ * @param {Vector2d} v
230
+ * @returns {Polygon} Reference to this object for method chaining
232
231
  */
233
232
  scaleV(v) {
234
233
  return this.scale(v.x, v.y);
@@ -238,9 +237,9 @@ class Polygon {
238
237
  * Computes the calculated collision polygon.
239
238
  * This **must** be called if the `points` array, `angle`, or `offset` is modified manually.
240
239
  * @name recalc
241
- * @memberOf me.Polygon.prototype
240
+ * @memberof Polygon.prototype
242
241
  * @function
243
- * @returns {me.Polygon} Reference to this object for method chaining
242
+ * @returns {Polygon} Reference to this object for method chaining
244
243
  */
245
244
  recalc() {
246
245
  var i;
@@ -278,10 +277,11 @@ class Polygon {
278
277
  return this;
279
278
  }
280
279
 
280
+
281
281
  /**
282
282
  * returns a list of indices for all triangles defined in this polygon
283
283
  * @name getIndices
284
- * @memberOf me.Polygon.prototype
284
+ * @memberof Polygon.prototype
285
285
  * @function
286
286
  * @returns {Array} an array of vertex indices for all triangles forming this polygon.
287
287
  */
@@ -292,22 +292,69 @@ class Polygon {
292
292
  return this.indices;
293
293
  }
294
294
 
295
+ /**
296
+ * Returns true if the vertices composing this polygon form a convex shape (vertices must be in clockwise order).
297
+ * @name isConvex
298
+ * @memberof Polygon.prototype
299
+ * @function
300
+ * @returns {boolean} true if the vertices are convex, false if not, null if not computable
301
+ */
302
+ isConvex() {
303
+ // http://paulbourke.net/geometry/polygonmesh/
304
+ // Copyright (c) Paul Bourke (use permitted)
305
+
306
+ var flag = 0,
307
+ vertices = this.points,
308
+ n = vertices.length,
309
+ i,
310
+ j,
311
+ k,
312
+ z;
313
+
314
+ if (n < 3) {
315
+ return null;
316
+ }
317
+
318
+ for (i = 0; i < n; i++) {
319
+ j = (i + 1) % n;
320
+ k = (i + 2) % n;
321
+ z = (vertices[j].x - vertices[i].x) * (vertices[k].y - vertices[j].y);
322
+ z -= (vertices[j].y - vertices[i].y) * (vertices[k].x - vertices[j].x);
323
+
324
+ if (z < 0) {
325
+ flag |= 1;
326
+ } else if (z > 0) {
327
+ flag |= 2;
328
+ }
329
+
330
+ if (flag === 3) {
331
+ return false;
332
+ }
333
+ }
334
+
335
+ if (flag !== 0) {
336
+ return true;
337
+ } else {
338
+ return null;
339
+ }
340
+ }
341
+
295
342
  /**
296
343
  * translate the Polygon by the specified offset
297
344
  * @name translate
298
- * @memberOf me.Polygon.prototype
345
+ * @memberof Polygon.prototype
299
346
  * @function
300
347
  * @param {number} x x offset
301
348
  * @param {number} y y offset
302
- * @returns {me.Polygon} this Polygon
349
+ * @returns {Polygon} this Polygon
303
350
  */
304
351
  /**
305
352
  * translate the Polygon by the specified vector
306
353
  * @name translate
307
- * @memberOf me.Polygon.prototype
354
+ * @memberof Polygon.prototype
308
355
  * @function
309
- * @param {me.Vector2d} v vector offset
310
- * @returns {me.Polygon} Reference to this object for method chaining
356
+ * @param {Vector2d} v vector offset
357
+ * @returns {Polygon} Reference to this object for method chaining
311
358
  */
312
359
  translate() {
313
360
  var _x, _y;
@@ -332,14 +379,14 @@ class Polygon {
332
379
  /**
333
380
  * Shifts the Polygon to the given position vector.
334
381
  * @name shift
335
- * @memberOf me.Polygon
382
+ * @memberof Polygon
336
383
  * @function
337
- * @param {me.Vector2d} position
384
+ * @param {Vector2d} position
338
385
  */
339
386
  /**
340
387
  * Shifts the Polygon to the given x, y position.
341
388
  * @name shift
342
- * @memberOf me.Polygon
389
+ * @memberof Polygon
343
390
  * @function
344
391
  * @param {number} x
345
392
  * @param {number} y
@@ -365,9 +412,9 @@ class Polygon {
365
412
  * (Note: it is highly recommended to first do a hit test on the corresponding <br>
366
413
  * bounding rect, as the function can be highly consuming with complex shapes)
367
414
  * @name contains
368
- * @memberOf me.Polygon.prototype
415
+ * @memberof Polygon.prototype
369
416
  * @function
370
- * @param {me.Vector2d} point
417
+ * @param {Vector2d} point
371
418
  * @returns {boolean} true if contains
372
419
  */
373
420
 
@@ -376,7 +423,7 @@ class Polygon {
376
423
  * (Note: it is highly recommended to first do a hit test on the corresponding <br>
377
424
  * bounding rect, as the function can be highly consuming with complex shapes)
378
425
  * @name contains
379
- * @memberOf me.Polygon.prototype
426
+ * @memberof Polygon.prototype
380
427
  * @function
381
428
  * @param {number} x x coordinate
382
429
  * @param {number} y y coordinate
@@ -414,9 +461,9 @@ class Polygon {
414
461
  /**
415
462
  * returns the bounding box for this shape, the smallest Rectangle object completely containing this shape.
416
463
  * @name getBounds
417
- * @memberOf me.Polygon.prototype
464
+ * @memberof Polygon.prototype
418
465
  * @function
419
- * @returns {me.Bounds} this shape bounding box Rectangle object
466
+ * @returns {Bounds} this shape bounding box Rectangle object
420
467
  */
421
468
  getBounds() {
422
469
  if (typeof this._bounds === "undefined") {
@@ -429,9 +476,9 @@ class Polygon {
429
476
  * update the bounding box for this shape.
430
477
  * @ignore
431
478
  * @name updateBounds
432
- * @memberOf me.Polygon.prototype
479
+ * @memberof Polygon.prototype
433
480
  * @function
434
- * @returns {me.Bounds} this shape bounding box Rectangle object
481
+ * @returns {Bounds} this shape bounding box Rectangle object
435
482
  */
436
483
  updateBounds() {
437
484
  var bounds = this.getBounds();
@@ -445,9 +492,9 @@ class Polygon {
445
492
  /**
446
493
  * clone this Polygon
447
494
  * @name clone
448
- * @memberOf me.Polygon.prototype
495
+ * @memberof Polygon.prototype
449
496
  * @function
450
- * @returns {me.Polygon} new Polygon
497
+ * @returns {Polygon} new Polygon
451
498
  */
452
499
  clone() {
453
500
  var copy = [];
@@ -4,18 +4,15 @@ import Polygon from "./poly.js";
4
4
  /**
5
5
  * @classdesc
6
6
  * a rectangle Object
7
- * @class Rect
8
- * @extends me.Polygon
9
- * @memberOf me
10
- * @constructor
11
- * @param {number} x position of the Rectangle
12
- * @param {number} y position of the Rectangle
13
- * @param {number} w width of the rectangle
14
- * @param {number} h height of the rectangle
7
+ * @augments Polygon
15
8
  */
16
-
17
9
  class Rect extends Polygon {
18
-
10
+ /**
11
+ * @param {number} x position of the Rectangle
12
+ * @param {number} y position of the Rectangle
13
+ * @param {number} w width of the rectangle
14
+ * @param {number} h height of the rectangle
15
+ */
19
16
  constructor(x, y, w, h) {
20
17
  // parent constructor
21
18
  super(x, y, [
@@ -35,13 +32,13 @@ class Rect extends Polygon {
35
32
  /**
36
33
  * set new value to the rectangle shape
37
34
  * @name setShape
38
- * @memberOf me.Rect.prototype
35
+ * @memberof Rect.prototype
39
36
  * @function
40
37
  * @param {number} x position of the Rectangle
41
38
  * @param {number} y position of the Rectangle
42
- * @param {number|me.Vector2d[]} w width of the rectangle, or an array of vector defining the rectangle
39
+ * @param {number|Vector2d[]} w width of the rectangle, or an array of vector defining the rectangle
43
40
  * @param {number} [h] height of the rectangle, if a numeral width parameter is specified
44
- * @returns {me.Rect} this rectangle
41
+ * @returns {Rect} this rectangle
45
42
  */
46
43
  setShape(x, y, w, h) {
47
44
  var points = w; // assume w is an array by default
@@ -66,7 +63,7 @@ class Rect extends Polygon {
66
63
  * @public
67
64
  * @type {number}
68
65
  * @name left
69
- * @memberOf me.Rect
66
+ * @memberof Rect
70
67
  */
71
68
  get left() {
72
69
  return this.pos.x;
@@ -77,7 +74,7 @@ class Rect extends Polygon {
77
74
  * @public
78
75
  * @type {number}
79
76
  * @name right
80
- * @memberOf me.Rect
77
+ * @memberof Rect
81
78
  */
82
79
  get right() {
83
80
  var w = this.width;
@@ -89,7 +86,7 @@ class Rect extends Polygon {
89
86
  * @public
90
87
  * @type {number}
91
88
  * @name top
92
- * @memberOf me.Rect
89
+ * @memberof Rect
93
90
  */
94
91
  get top() {
95
92
  return this.pos.y;
@@ -100,7 +97,7 @@ class Rect extends Polygon {
100
97
  * @public
101
98
  * @type {number}
102
99
  * @name bottom
103
- * @memberOf me.Rect
100
+ * @memberof Rect
104
101
  */
105
102
  get bottom() {
106
103
  var h = this.height;
@@ -112,7 +109,7 @@ class Rect extends Polygon {
112
109
  * @public
113
110
  * @type {number}
114
111
  * @name width
115
- * @memberOf me.Rect
112
+ * @memberof Rect
116
113
  */
117
114
  get width() {
118
115
  return this.points[2].x;
@@ -128,7 +125,7 @@ class Rect extends Polygon {
128
125
  * @public
129
126
  * @type {number}
130
127
  * @name height
131
- * @memberOf me.Rect
128
+ * @memberof Rect
132
129
  */
133
130
  get height() {
134
131
  return this.points[2].y;
@@ -144,7 +141,7 @@ class Rect extends Polygon {
144
141
  * @public
145
142
  * @type {number}
146
143
  * @name centerX
147
- * @memberOf me.Rect
144
+ * @memberof Rect
148
145
  */
149
146
  get centerX() {
150
147
  if (isFinite(this.width)) {
@@ -162,7 +159,7 @@ class Rect extends Polygon {
162
159
  * @public
163
160
  * @type {number}
164
161
  * @name centerY
165
- * @memberOf me.Rect
162
+ * @memberof Rect
166
163
  */
167
164
  get centerY() {
168
165
  if (isFinite(this.height)) {
@@ -178,11 +175,11 @@ class Rect extends Polygon {
178
175
  /**
179
176
  * resize the rectangle
180
177
  * @name resize
181
- * @memberOf me.Rect.prototype
178
+ * @memberof Rect.prototype
182
179
  * @function
183
180
  * @param {number} w new width of the rectangle
184
181
  * @param {number} h new height of the rectangle
185
- * @returns {me.Rect} this rectangle
182
+ * @returns {Rect} this rectangle
186
183
  */
187
184
  resize(w, h) {
188
185
  this.width = w;
@@ -193,11 +190,11 @@ class Rect extends Polygon {
193
190
  /**
194
191
  * scale the rectangle
195
192
  * @name scale
196
- * @memberOf me.Rect.prototype
193
+ * @memberof Rect.prototype
197
194
  * @function
198
195
  * @param {number} x a number representing the abscissa of the scaling vector.
199
196
  * @param {number} [y=x] a number representing the ordinate of the scaling vector.
200
- * @returns {me.Rect} this rectangle
197
+ * @returns {Rect} this rectangle
201
198
  */
202
199
  scale(x, y = x) {
203
200
  this.width *= x;
@@ -208,9 +205,9 @@ class Rect extends Polygon {
208
205
  /**
209
206
  * clone this rectangle
210
207
  * @name clone
211
- * @memberOf me.Rect.prototype
208
+ * @memberof Rect.prototype
212
209
  * @function
213
- * @returns {me.Rect} new rectangle
210
+ * @returns {Rect} new rectangle
214
211
  */
215
212
  clone() {
216
213
  return new Rect(this.pos.x, this.pos.y, this.width, this.height);
@@ -219,10 +216,10 @@ class Rect extends Polygon {
219
216
  /**
220
217
  * copy the position and size of the given rectangle into this one
221
218
  * @name copy
222
- * @memberOf me.Rect.prototype
219
+ * @memberof Rect.prototype
223
220
  * @function
224
- * @param {me.Rect} rect Source rectangle
225
- * @returns {me.Rect} new rectangle
221
+ * @param {Rect} rect Source rectangle
222
+ * @returns {Rect} new rectangle
226
223
  */
227
224
  copy(rect) {
228
225
  return this.setShape(rect.pos.x, rect.pos.y, rect.width, rect.height);
@@ -231,10 +228,10 @@ class Rect extends Polygon {
231
228
  /**
232
229
  * merge this rectangle with another one
233
230
  * @name union
234
- * @memberOf me.Rect.prototype
231
+ * @memberof Rect.prototype
235
232
  * @function
236
- * @param {me.Rect} rect other rectangle to union with
237
- * @returns {me.Rect} the union(ed) rectangle
233
+ * @param {Rect} rect other rectangle to union with
234
+ * @returns {Rect} the union(ed) rectangle
238
235
  */
239
236
  union(rect) {
240
237
  var x1 = Math.min(this.left, rect.left);
@@ -253,9 +250,9 @@ class Rect extends Polygon {
253
250
  /**
254
251
  * check if this rectangle is intersecting with the specified one
255
252
  * @name overlaps
256
- * @memberOf me.Rect.prototype
253
+ * @memberof Rect.prototype
257
254
  * @function
258
- * @param {me.Rect} rect
255
+ * @param {Rect} rect
259
256
  * @returns {boolean} true if overlaps
260
257
  */
261
258
  overlaps(rect) {
@@ -270,16 +267,16 @@ class Rect extends Polygon {
270
267
  /**
271
268
  * Returns true if the rectangle contains the given rectangle
272
269
  * @name contains
273
- * @memberOf me.Rect.prototype
270
+ * @memberof Rect.prototype
274
271
  * @function
275
- * @param {me.Rect} rect
272
+ * @param {Rect} rect
276
273
  * @returns {boolean} true if contains
277
274
  */
278
275
 
279
276
  /**
280
277
  * Returns true if the rectangle contains the given point
281
278
  * @name contains
282
- * @memberOf me.Rect.prototype
279
+ * @memberof Rect.prototype
283
280
  * @function
284
281
  * @param {number} x x coordinate
285
282
  * @param {number} y y coordinate
@@ -289,9 +286,9 @@ class Rect extends Polygon {
289
286
  /**
290
287
  * Returns true if the rectangle contains the given point
291
288
  * @name contains
292
- * @memberOf me.Rect
289
+ * @memberof Rect
293
290
  * @function
294
- * @param {me.Vector2d} point
291
+ * @param {Vector2d} point
295
292
  * @returns {boolean} true if contains
296
293
  */
297
294
  contains() {
@@ -325,9 +322,9 @@ class Rect extends Polygon {
325
322
  /**
326
323
  * check if this rectangle is identical to the specified one
327
324
  * @name equals
328
- * @memberOf me.Rect.prototype
325
+ * @memberof Rect.prototype
329
326
  * @function
330
- * @param {me.Rect} rect
327
+ * @param {Rect} rect
331
328
  * @returns {boolean} true if equals
332
329
  */
333
330
  equals(rect) {
@@ -342,7 +339,7 @@ class Rect extends Polygon {
342
339
  /**
343
340
  * determines whether all coordinates of this rectangle are finite numbers.
344
341
  * @name isFinite
345
- * @memberOf me.Rect.prototype
342
+ * @memberof Rect.prototype
346
343
  * @function
347
344
  * @returns {boolean} false if all coordinates are positive or negative Infinity or NaN; otherwise, true.
348
345
  */
@@ -353,9 +350,9 @@ class Rect extends Polygon {
353
350
  /**
354
351
  * Returns a polygon whose edges are the same as this box.
355
352
  * @name toPolygon
356
- * @memberOf me.Rect.prototype
353
+ * @memberof Rect.prototype
357
354
  * @function
358
- * @returns {me.Polygon} a new Polygon that represents this rectangle.
355
+ * @returns {Polygon} a new Polygon that represents this rectangle.
359
356
  */
360
357
  toPolygon() {
361
358
  return new Polygon(