melonjs 10.10.0 → 11.0.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 (95) hide show
  1. package/README.md +4 -3
  2. package/dist/melonjs.js +1071 -2102
  3. package/dist/melonjs.min.js +4 -4
  4. package/dist/melonjs.module.d.ts +600 -1351
  5. package/dist/melonjs.module.js +996 -2029
  6. package/package.json +16 -19
  7. package/src/audio/audio.js +0 -1
  8. package/src/camera/camera2d.js +1 -16
  9. package/src/entity/entity.js +6 -11
  10. package/src/geometries/ellipse.js +3 -12
  11. package/src/geometries/line.js +1 -4
  12. package/src/geometries/path2d.js +4 -14
  13. package/src/geometries/poly.js +6 -24
  14. package/src/geometries/rectangle.js +3 -15
  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 +4 -5
  46. package/src/physics/bounds.js +5 -19
  47. package/src/physics/collision.js +1 -13
  48. package/src/physics/detector.js +6 -56
  49. package/src/physics/quadtree.js +0 -7
  50. package/src/physics/response.js +48 -0
  51. package/src/physics/sat.js +4 -4
  52. package/src/physics/world.js +0 -4
  53. package/src/plugin/plugin.js +0 -2
  54. package/src/polyfill/roundrect.js +4 -2
  55. package/src/renderable/GUI.js +6 -9
  56. package/src/renderable/collectable.js +1 -0
  57. package/src/renderable/colorlayer.js +9 -7
  58. package/src/renderable/container.js +12 -38
  59. package/src/renderable/dragndrop.js +1 -10
  60. package/src/renderable/imagelayer.js +6 -10
  61. package/src/renderable/light2d.js +48 -16
  62. package/src/renderable/renderable.js +6 -28
  63. package/src/renderable/sprite.js +4 -16
  64. package/src/renderable/trigger.js +10 -3
  65. package/src/state/stage.js +0 -4
  66. package/src/state/state.js +22 -23
  67. package/src/system/device.js +16 -119
  68. package/src/system/dom.js +69 -0
  69. package/src/system/event.js +22 -0
  70. package/src/system/pooling.js +20 -9
  71. package/src/system/save.js +9 -11
  72. package/src/system/timer.js +239 -218
  73. package/src/text/bitmaptextdata.js +1 -4
  74. package/src/text/glyph.js +2 -2
  75. package/src/text/text.js +13 -8
  76. package/src/text/textmetrics.js +0 -2
  77. package/src/tweens/easing.js +1 -1
  78. package/src/tweens/interpolation.js +2 -2
  79. package/src/tweens/tween.js +1 -13
  80. package/src/utils/agent.js +1 -3
  81. package/src/utils/array.js +0 -3
  82. package/src/utils/file.js +0 -2
  83. package/src/utils/function.js +0 -2
  84. package/src/utils/string.js +0 -6
  85. package/src/utils/utils.js +0 -3
  86. package/src/video/canvas/canvas_renderer.js +4 -39
  87. package/src/video/renderer.js +1 -23
  88. package/src/video/texture/atlas.js +2 -0
  89. package/src/video/texture/cache.js +0 -1
  90. package/src/video/texture/canvas_texture.js +16 -4
  91. package/src/video/video.js +3 -3
  92. package/src/video/webgl/glshader.js +0 -5
  93. package/src/video/webgl/utils/uniforms.js +3 -6
  94. package/src/video/webgl/webgl_compositor.js +0 -14
  95. package/src/video/webgl/webgl_renderer.js +0 -42
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "melonjs",
3
- "version": "10.10.0",
3
+ "version": "11.0.0",
4
4
  "description": "melonJS Game Engine",
5
5
  "homepage": "http://www.melonjs.org/",
6
6
  "keywords": [
@@ -55,47 +55,44 @@
55
55
  ],
56
56
  "dependencies": {
57
57
  "@teppeis/multimaps": "^2.0.0",
58
- "core-js": "^3.22.8",
58
+ "core-js": "^3.23.2",
59
59
  "earcut": "2.2.3",
60
60
  "eventemitter3": "^4.0.7",
61
61
  "howler": "2.2.3"
62
62
  },
63
63
  "devDependencies": {
64
- "@melonjs/jsdoc-template": "^2.0.2",
64
+ "@melonjs/webdoc-theme": "^1.1.1",
65
65
  "@rollup/plugin-buble": "^0.21.3",
66
66
  "@rollup/plugin-commonjs": "^22.0.0",
67
67
  "@rollup/plugin-node-resolve": "^13.3.0",
68
68
  "@rollup/plugin-replace": "^4.0.0",
69
69
  "@types/offscreencanvas": "^2019.7.0",
70
- "@webdoc/cli": "^1.6.0",
71
- "cheerio": "^1.0.0-rc.11",
70
+ "@webdoc/cli": "^1.6.6",
72
71
  "del-cli": "^4.0.1",
73
- "eslint": "^8.17.0",
74
- "eslint-plugin-jsdoc": "^39.3.2",
75
- "jasmine-core": "^4.1.1",
76
- "jsdoc": "^3.6.10",
77
- "karma": "^6.3.20",
72
+ "eslint": "^8.18.0",
73
+ "jasmine-core": "^4.2.0",
74
+ "karma": "^6.4.0",
78
75
  "karma-chrome-launcher": "^3.1.1",
79
76
  "karma-coverage": "^2.2.0",
80
77
  "karma-html-detailed-reporter": "^2.1.0",
81
- "karma-jasmine": "^5.0.1",
78
+ "karma-jasmine": "^5.1.0",
82
79
  "karma-nyan-reporter": "0.2.5",
83
- "qs": "^6.10.5",
84
- "rollup": "^2.75.5",
80
+ "rollup": "^2.75.7",
85
81
  "rollup-plugin-bundle-size": "^1.0.3",
86
82
  "rollup-plugin-string": "^3.0.0",
87
- "terser": "^5.14.0",
88
- "typescript": "^4.7.3"
83
+ "terser": "^5.14.1",
84
+ "typescript": "^4.7.4"
89
85
  },
90
86
  "scripts": {
91
87
  "build": "npm run lint && rollup -c --silent",
92
88
  "dist": " npm run build && npm run minify && mkdirp dist && cp -f build/*.js dist/ && npm run types",
93
89
  "minify": "terser build/melonjs.js --compress --mangle --comments '/(?:^!|@(?:license|preserve|cc_on))/' --output build/melonjs.min.js",
94
90
  "lint": "eslint src rollup.config.js",
95
- "test": "npm run build && karma start tests/karma.conf.cjs",
96
- "doc": "mkdirp docs && jsdoc -c jsdoc_conf.json",
97
- "webdoc": "mkdirp dist && webdoc --quiet -R README.md",
98
- "release": "npm run dist && npm publish --access public",
91
+ "test": "npm run test-node && karma start tests/karma.conf.cjs",
92
+ "test-node": "node build/melonjs.module.js",
93
+ "doc": "mkdirp docs && webdoc --quiet --site-root melonJS/docs -R README.md",
94
+ "serve": "python3 -m http.server",
95
+ "prepublishOnly": "npm run dist && npm run test",
99
96
  "clean": "del-cli --force build/*.js dist/*.js dist/*.d.ts docs src/**/*.d.ts",
100
97
  "types": "tsc dist/melonjs.module.js --declaration --allowJs --emitDeclarationOnly"
101
98
  }
@@ -517,7 +517,6 @@ export function unload(sound_name) {
517
517
  /**
518
518
  * unload all audio to free memory
519
519
  * @function audio.unloadAll
520
- * @function
521
520
  * @example
522
521
  * me.audio.unloadAll();
523
522
  */
@@ -14,7 +14,7 @@ import { world } from "./../game.js";
14
14
 
15
15
 
16
16
  // some ref shortcut
17
- var MIN = Math.min, MAX = Math.max;
17
+ const MIN = Math.min, MAX = Math.max;
18
18
 
19
19
  var targetV = new Vector2d();
20
20
 
@@ -207,7 +207,6 @@ class Camera2d extends Renderable {
207
207
  * reset the camera position to specified coordinates
208
208
  * @name reset
209
209
  * @memberof Camera2d
210
- * @function
211
210
  * @param {number} [x=0]
212
211
  * @param {number} [y=0]
213
212
  */
@@ -238,7 +237,6 @@ class Camera2d extends Renderable {
238
237
  * @name setDeadzone
239
238
  * @see Camera2d.follow
240
239
  * @memberof Camera2d
241
- * @function
242
240
  * @param {number} w deadzone width
243
241
  * @param {number} h deadzone height
244
242
  */
@@ -266,7 +264,6 @@ class Camera2d extends Renderable {
266
264
  * resize the camera
267
265
  * @name resize
268
266
  * @memberof Camera2d
269
- * @function
270
267
  * @param {number} w new width of the camera
271
268
  * @param {number} h new height of the camera
272
269
  * @returns {Camera2d} this camera
@@ -298,7 +295,6 @@ class Camera2d extends Renderable {
298
295
  * the camera is bound to the given coordinates and cannot move/be scrolled outside of it.
299
296
  * @name setBounds
300
297
  * @memberof Camera2d
301
- * @function
302
298
  * @param {number} x world left limit
303
299
  * @param {number} y world top limit
304
300
  * @param {number} w world width limit
@@ -317,7 +313,6 @@ class Camera2d extends Renderable {
317
313
  * (this will put the camera center around the given target)
318
314
  * @name follow
319
315
  * @memberof Camera2d
320
- * @function
321
316
  * @param {Renderable|Vector2d} target renderable or position vector to follow
322
317
  * @param {number} [axis=me.game.viewport.AXIS.BOTH] Which axis to follow (see {@link Camera2d.AXIS})
323
318
  * @param {number} [damping=1] default damping value
@@ -359,7 +354,6 @@ class Camera2d extends Renderable {
359
354
  * unfollow the current target
360
355
  * @name unfollow
361
356
  * @memberof Camera2d
362
- * @function
363
357
  */
364
358
  unfollow() {
365
359
  this.target = null;
@@ -371,7 +365,6 @@ class Camera2d extends Renderable {
371
365
  * @name move
372
366
  * @memberof Camera2d
373
367
  * @see Camera2d.focusOn
374
- * @function
375
368
  * @param {number} x
376
369
  * @param {number} y
377
370
  * @example
@@ -387,7 +380,6 @@ class Camera2d extends Renderable {
387
380
  * @name moveTo
388
381
  * @memberof Camera2d
389
382
  * @see Camera2d.focusOn
390
- * @function
391
383
  * @param {number} x
392
384
  * @param {number} y
393
385
  */
@@ -511,7 +503,6 @@ class Camera2d extends Renderable {
511
503
  * shake the camera
512
504
  * @name shake
513
505
  * @memberof Camera2d
514
- * @function
515
506
  * @param {number} intensity maximum offset that the screen can be moved
516
507
  * while shaking
517
508
  * @param {number} duration expressed in milliseconds
@@ -536,7 +527,6 @@ class Camera2d extends Renderable {
536
527
  * screen is filled with the specified color and slowly goes back to normal
537
528
  * @name fadeOut
538
529
  * @memberof Camera2d
539
- * @function
540
530
  * @param {Color|string} color a CSS color value
541
531
  * @param {number} [duration=1000] expressed in milliseconds
542
532
  * @param {Function} [onComplete] callback once effect is over
@@ -562,7 +552,6 @@ class Camera2d extends Renderable {
562
552
  * fade to the specified color
563
553
  * @name fadeIn
564
554
  * @memberof Camera2d
565
- * @function
566
555
  * @param {Color|string} color a CSS color value
567
556
  * @param {number} [duration=1000] expressed in milliseconds
568
557
  * @param {Function} [onComplete] callback once effect is over
@@ -585,7 +574,6 @@ class Camera2d extends Renderable {
585
574
  * set the camera position around the specified object
586
575
  * @name focusOn
587
576
  * @memberof Camera2d
588
- * @function
589
577
  * @param {Renderable} target the renderable to focus the camera on
590
578
  */
591
579
  focusOn(target) {
@@ -600,7 +588,6 @@ class Camera2d extends Renderable {
600
588
  * check if the specified renderable is in the camera
601
589
  * @name isVisible
602
590
  * @memberof Camera2d
603
- * @function
604
591
  * @param {Renderable} obj to be checked against
605
592
  * @param {boolean} [floating = obj.floating] if visibility check should be done against screen coordinates
606
593
  * @returns {boolean}
@@ -619,7 +606,6 @@ class Camera2d extends Renderable {
619
606
  * convert the given "local" (screen) coordinates into world coordinates
620
607
  * @name localToWorld
621
608
  * @memberof Camera2d
622
- * @function
623
609
  * @param {number} x
624
610
  * @param {number} y
625
611
  * @param {number} [v] an optional vector object where to set the
@@ -640,7 +626,6 @@ class Camera2d extends Renderable {
640
626
  * convert the given world coordinates into "local" (screen) coordinates
641
627
  * @name worldToLocal
642
628
  * @memberof Camera2d
643
- * @function
644
629
  * @param {number} x
645
630
  * @param {number} y
646
631
  * @param {number} [v] an optional vector object where to set the
@@ -95,7 +95,7 @@ class Entity extends Renderable {
95
95
  /**
96
96
  * the entity body object
97
97
  * @public
98
- * @type {Body}
98
+ * @member {Body}
99
99
  * @name body
100
100
  * @memberof Entity
101
101
  */
@@ -158,7 +158,6 @@ class Entity extends Renderable {
158
158
  * @ignore
159
159
  * @name onBodyUpdate
160
160
  * @memberof Entity
161
- * @function
162
161
  * @param {Body} body the body whose bounds to update
163
162
  */
164
163
  onBodyUpdate(body) {
@@ -189,24 +188,21 @@ class Entity extends Renderable {
189
188
  }
190
189
 
191
190
  /**
192
- * object draw<br>
193
- * not to be called by the end user<br>
194
- * called by the game manager on each game loop
191
+ * draw this entity (automatically called by melonJS)
195
192
  * @name draw
196
193
  * @memberof Entity
197
- * @function
198
194
  * @protected
199
- * @param {CanvasRenderer|WebGLRenderer} renderer a renderer object
200
- * @param {Rect} rect region to draw
195
+ * @param {CanvasRenderer|WebGLRenderer} renderer a renderer instance
196
+ * @param {Camera2d} [viewport] the viewport to (re)draw
201
197
  */
202
- draw(renderer, rect) {
198
+ draw(renderer, viewport) {
203
199
  var renderable = this.renderable;
204
200
  if (renderable instanceof Renderable) {
205
201
  // predraw (apply transforms)
206
202
  renderable.preDraw(renderer);
207
203
 
208
204
  // draw the object
209
- renderable.draw(renderer, rect);
205
+ renderable.draw(renderer, viewport);
210
206
 
211
207
  // postdraw (clean-up);
212
208
  renderable.postDraw(renderer);
@@ -233,7 +229,6 @@ class Entity extends Renderable {
233
229
  * Called by engine before deleting the object
234
230
  * @name onDeactivateEvent
235
231
  * @memberof Entity
236
- * @function
237
232
  */
238
233
  onDeactivateEvent() {
239
234
  if (this.renderable && this.renderable.onDeactivateEvent) {
@@ -77,7 +77,6 @@ class Ellipse {
77
77
  * set new value to the Ellipse shape
78
78
  * @name setShape
79
79
  * @memberof Ellipse
80
- * @function
81
80
  * @param {number} x the center x coordinate of the ellipse
82
81
  * @param {number} y the center y coordinate of the ellipse
83
82
  * @param {number} w width (diameter) of the ellipse
@@ -107,7 +106,6 @@ class Ellipse {
107
106
  * Rotate this Ellipse (counter-clockwise) by the specified angle (in radians).
108
107
  * @name rotate
109
108
  * @memberof Ellipse
110
- * @function
111
109
  * @param {number} angle The angle to rotate (in radians)
112
110
  * @param {Vector2d|ObservableVector2d} [v] an optional point to rotate around
113
111
  * @returns {Ellipse} Reference to this object for method chaining
@@ -124,7 +122,6 @@ class Ellipse {
124
122
  * Scale this Ellipse by the specified scalar.
125
123
  * @name scale
126
124
  * @memberof Ellipse
127
- * @function
128
125
  * @param {number} x
129
126
  * @param {number} [y=x]
130
127
  * @returns {Ellipse} Reference to this object for method chaining
@@ -143,7 +140,6 @@ class Ellipse {
143
140
  * Scale this Ellipse by the specified vector.
144
141
  * @name scale
145
142
  * @memberof Ellipse
146
- * @function
147
143
  * @param {Vector2d} v
148
144
  * @returns {Ellipse} Reference to this object for method chaining
149
145
  */
@@ -155,11 +151,10 @@ class Ellipse {
155
151
  * apply the given transformation matrix to this ellipse
156
152
  * @name transform
157
153
  * @memberof Ellipse
158
- * @function
159
154
  * @param {Matrix2d} matrix the transformation matrix
160
155
  * @returns {Polygon} Reference to this object for method chaining
161
156
  */
162
- transform(/* m */) {
157
+ transform(matrix) { // eslint-disable-line no-unused-vars
163
158
  // TODO
164
159
  return this;
165
160
  }
@@ -168,7 +163,7 @@ class Ellipse {
168
163
  * translate the circle/ellipse by the specified offset
169
164
  * @name translate
170
165
  * @memberof Ellipse
171
- * @function
166
+ * @method
172
167
  * @param {number} x x offset
173
168
  * @param {number} y y offset
174
169
  * @returns {Ellipse} this ellipse
@@ -177,7 +172,6 @@ class Ellipse {
177
172
  * translate the circle/ellipse by the specified vector
178
173
  * @name translate
179
174
  * @memberof Ellipse
180
- * @function
181
175
  * @param {Vector2d} v vector offset
182
176
  * @returns {Ellipse} this ellipse
183
177
  */
@@ -204,8 +198,8 @@ class Ellipse {
204
198
  /**
205
199
  * check if this circle/ellipse contains the specified point
206
200
  * @name contains
201
+ * @method
207
202
  * @memberof Ellipse
208
- * @function
209
203
  * @param {Vector2d} point
210
204
  * @returns {boolean} true if contains
211
205
  */
@@ -214,7 +208,6 @@ class Ellipse {
214
208
  * check if this circle/ellipse contains the specified point
215
209
  * @name contains
216
210
  * @memberof Ellipse
217
- * @function
218
211
  * @param {number} x x coordinate
219
212
  * @param {number} y y coordinate
220
213
  * @returns {boolean} true if contains
@@ -246,7 +239,6 @@ class Ellipse {
246
239
  * returns the bounding box for this shape, the smallest Rectangle object completely containing this shape.
247
240
  * @name getBounds
248
241
  * @memberof Ellipse
249
- * @function
250
242
  * @returns {Bounds} this shape bounding box Rectangle object
251
243
  */
252
244
  getBounds() {
@@ -260,7 +252,6 @@ class Ellipse {
260
252
  * clone this Ellipse
261
253
  * @name clone
262
254
  * @memberof Ellipse
263
- * @function
264
255
  * @returns {Ellipse} new Ellipse
265
256
  */
266
257
  clone() {
@@ -16,7 +16,7 @@ class Line extends Polygon {
16
16
  * Returns true if the Line contains the given point
17
17
  * @name contains
18
18
  * @memberof Line
19
- * @function
19
+ * @method
20
20
  * @param {Vector2d} point
21
21
  * @returns {boolean} true if contains
22
22
  */
@@ -25,7 +25,6 @@ class Line extends Polygon {
25
25
  * Returns true if the Line contains the given point
26
26
  * @name contains
27
27
  * @memberof Line
28
- * @function
29
28
  * @param {number} x x coordinate
30
29
  * @param {number} y y coordinate
31
30
  * @returns {boolean} true if contains
@@ -59,7 +58,6 @@ class Line extends Polygon {
59
58
  * This **must** be called if the `points` array, `angle`, or `offset` is modified manually.
60
59
  * @name recalc
61
60
  * @memberof Line
62
- * @function
63
61
  * @returns {Line} this instance for objecf chaining
64
62
  */
65
63
  recalc() {
@@ -95,7 +93,6 @@ class Line extends Polygon {
95
93
  * clone this line segment
96
94
  * @name clone
97
95
  * @memberof Line
98
- * @function
99
96
  * @returns {Line} new Line
100
97
  */
101
98
  clone() {
@@ -35,7 +35,6 @@ class Path2D {
35
35
  * begin a new path
36
36
  * @name beginPath
37
37
  * @memberof Path2D
38
- * @function
39
38
  */
40
39
  beginPath() {
41
40
  // empty the cache and recycle all vectors
@@ -51,7 +50,6 @@ class Path2D {
51
50
  * If the shape has already been closed or has only one point, this function does nothing.
52
51
  * @name closePath
53
52
  * @memberof Path2D
54
- * @function
55
53
  */
56
54
  closePath() {
57
55
  var points = this.points;
@@ -64,7 +62,6 @@ class Path2D {
64
62
  * triangulate the shape defined by this path into an array of triangles
65
63
  * @name triangulatePath
66
64
  * @memberof Path2D
67
- * @function
68
65
  * @returns {Vector2d[]}
69
66
  */
70
67
  triangulatePath() {
@@ -95,7 +92,6 @@ class Path2D {
95
92
  * moves the starting point of the current path to the (x, y) coordinates.
96
93
  * @name moveTo
97
94
  * @memberof Path2D
98
- * @function
99
95
  * @param {number} x the x-axis (horizontal) coordinate of the point.
100
96
  * @param {number} y the y-axis (vertical) coordinate of the point.
101
97
  */
@@ -107,7 +103,6 @@ class Path2D {
107
103
  * connects the last point in the current patch to the (x, y) coordinates with a straight line.
108
104
  * @name lineTo
109
105
  * @memberof Path2D
110
- * @function
111
106
  * @param {number} x the x-axis coordinate of the line's end point.
112
107
  * @param {number} y the y-axis coordinate of the line's end point.
113
108
  */
@@ -120,7 +115,6 @@ class Path2D {
120
115
  * starting at startAngle and ending at endAngle going in the given direction by counterclockwise (defaulting to clockwise).
121
116
  * @name arc
122
117
  * @memberof Path2D
123
- * @function
124
118
  * @param {number} x the horizontal coordinate of the arc's center.
125
119
  * @param {number} y the vertical coordinate of the arc's center.
126
120
  * @param {number} radius the arc's radius. Must be positive.
@@ -170,11 +164,10 @@ class Path2D {
170
164
  * adds a circular arc to the path with the given control points and radius, connected to the previous point by a straight line.
171
165
  * @name arcTo
172
166
  * @memberof Path2D
173
- * @function
174
- * @param {number} x the x-axis coordinate of the first control point.
175
- * @param {number} y the y-axis coordinate of the first control point.
176
- * @param {number} x the x-axis coordinate of the second control point.
177
- * @param {number} y the y-axis coordinate of the second control point.
167
+ * @param {number} x1 the x-axis coordinate of the first control point.
168
+ * @param {number} y1 the y-axis coordinate of the first control point.
169
+ * @param {number} x2 the x-axis coordinate of the second control point.
170
+ * @param {number} y2 the y-axis coordinate of the second control point.
178
171
  * @param {number} radius the arc's radius. Must be positive.
179
172
  */
180
173
  arcTo(x1, y1, x2, y2, radius) {
@@ -219,7 +212,6 @@ class Path2D {
219
212
  * starting at startAngle and ending at endAngle going in the given direction by counterclockwise.
220
213
  * @name ellipse
221
214
  * @memberof Path2D
222
- * @function
223
215
  * @param {number} x the x-axis (horizontal) coordinate of the ellipse's center.
224
216
  * @param {number} y the y-axis (vertical) coordinate of the ellipse's center.
225
217
  * @param {number} radiusX the ellipse's major-axis radius. Must be non-negative.
@@ -279,7 +271,6 @@ class Path2D {
279
271
  * creates a path for a rectangle at position (x, y) with a size that is determined by width and height.
280
272
  * @name rect
281
273
  * @memberof Path2D
282
- * @function
283
274
  * @param {number} x the x-axis coordinate of the rectangle's starting point.
284
275
  * @param {number} y the y-axis coordinate of the rectangle's starting point.
285
276
  * @param {number} width the rectangle's width. Positive values are to the right, and negative to the left.
@@ -297,7 +288,6 @@ class Path2D {
297
288
  * adds an rounded rectangle to the current path.
298
289
  * @name roundRect
299
290
  * @memberof Path2D
300
- * @function
301
291
  * @param {number} x the x-axis coordinate of the rectangle's starting point.
302
292
  * @param {number} y the y-axis coordinate of the rectangle's starting point.
303
293
  * @param {number} width the rectangle's width. Positive values are to the right, and negative to the left.
@@ -9,11 +9,10 @@ import pool from "./../system/pooling.js";
9
9
  * A polygon is convex when all line segments connecting two points in the interior do not cross any edge of the polygon
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
- * A polygon's `winding` is clockwise iff its vertices (points) are declared turning to the right. The image above shows COUNTERCLOCKWISE winding.
12
+ *
13
+ * A polygon's `winding` is clockwise if its vertices (points) are declared turning to the right. The image above shows COUNTERCLOCKWISE winding.
13
14
  */
14
-
15
15
  class Polygon {
16
-
17
16
  /**
18
17
  * @param {number} x origin point of the Polygon
19
18
  * @param {number} y origin point of the Polygon
@@ -32,7 +31,7 @@ class Polygon {
32
31
  /**
33
32
  * The bounding rectangle for this shape
34
33
  * @ignore
35
- * @type {Bounds}
34
+ * @member {Bounds}
36
35
  * @name _bounds
37
36
  * @memberof Polygon
38
37
  */
@@ -84,7 +83,6 @@ class Polygon {
84
83
  * set new value to the Polygon
85
84
  * @name setShape
86
85
  * @memberof Polygon
87
- * @function
88
86
  * @param {number} x position of the Polygon
89
87
  * @param {number} y position of the Polygon
90
88
  * @param {Vector2d[]|number[]} points array of vector or vertice defining the Polygon
@@ -100,7 +98,6 @@ class Polygon {
100
98
  * set the vertices defining this Polygon
101
99
  * @name setVertices
102
100
  * @memberof Polygon
103
- * @function
104
101
  * @param {Vector2d[]} vertices array of vector or vertice defining the Polygon
105
102
  * @returns {Polygon} this instance for objecf chaining
106
103
  */
@@ -140,7 +137,6 @@ class Polygon {
140
137
  * apply the given transformation matrix to this Polygon
141
138
  * @name transform
142
139
  * @memberof Polygon
143
- * @function
144
140
  * @param {Matrix2d} m the transformation matrix
145
141
  * @returns {Polygon} Reference to this object for method chaining
146
142
  */
@@ -159,7 +155,6 @@ class Polygon {
159
155
  * apply an isometric projection to this shape
160
156
  * @name toIso
161
157
  * @memberof Polygon
162
- * @function
163
158
  * @returns {Polygon} Reference to this object for method chaining
164
159
  */
165
160
  toIso() {
@@ -170,7 +165,6 @@ class Polygon {
170
165
  * apply a 2d projection to this shape
171
166
  * @name to2d
172
167
  * @memberof Polygon
173
- * @function
174
168
  * @returns {Polygon} Reference to this object for method chaining
175
169
  */
176
170
  to2d() {
@@ -181,7 +175,6 @@ class Polygon {
181
175
  * Rotate this Polygon (counter-clockwise) by the specified angle (in radians).
182
176
  * @name rotate
183
177
  * @memberof Polygon
184
- * @function
185
178
  * @param {number} angle The angle to rotate (in radians)
186
179
  * @param {Vector2d|ObservableVector2d} [v] an optional point to rotate around
187
180
  * @returns {Polygon} Reference to this object for method chaining
@@ -203,7 +196,6 @@ class Polygon {
203
196
  * Scale this Polygon by the given scalar.
204
197
  * @name scale
205
198
  * @memberof Polygon
206
- * @function
207
199
  * @param {number} x
208
200
  * @param {number} [y=x]
209
201
  * @returns {Polygon} Reference to this object for method chaining
@@ -225,7 +217,6 @@ class Polygon {
225
217
  * Scale this Polygon by the given vector
226
218
  * @name scaleV
227
219
  * @memberof Polygon
228
- * @function
229
220
  * @param {Vector2d} v
230
221
  * @returns {Polygon} Reference to this object for method chaining
231
222
  */
@@ -238,7 +229,6 @@ class Polygon {
238
229
  * This **must** be called if the `points` array, `angle`, or `offset` is modified manually.
239
230
  * @name recalc
240
231
  * @memberof Polygon
241
- * @function
242
232
  * @returns {Polygon} Reference to this object for method chaining
243
233
  */
244
234
  recalc() {
@@ -282,7 +272,6 @@ class Polygon {
282
272
  * returns a list of indices for all triangles defined in this polygon
283
273
  * @name getIndices
284
274
  * @memberof Polygon
285
- * @function
286
275
  * @returns {Array} an array of vertex indices for all triangles forming this polygon.
287
276
  */
288
277
  getIndices() {
@@ -296,7 +285,6 @@ class Polygon {
296
285
  * Returns true if the vertices composing this polygon form a convex shape (vertices must be in clockwise order).
297
286
  * @name isConvex
298
287
  * @memberof Polygon
299
- * @function
300
288
  * @returns {boolean} true if the vertices are convex, false if not, null if not computable
301
289
  */
302
290
  isConvex() {
@@ -343,7 +331,7 @@ class Polygon {
343
331
  * translate the Polygon by the specified offset
344
332
  * @name translate
345
333
  * @memberof Polygon
346
- * @function
334
+ * @method
347
335
  * @param {number} x x offset
348
336
  * @param {number} y y offset
349
337
  * @returns {Polygon} this Polygon
@@ -352,7 +340,6 @@ class Polygon {
352
340
  * translate the Polygon by the specified vector
353
341
  * @name translate
354
342
  * @memberof Polygon
355
- * @function
356
343
  * @param {Vector2d} v vector offset
357
344
  * @returns {Polygon} Reference to this object for method chaining
358
345
  */
@@ -380,14 +367,13 @@ class Polygon {
380
367
  * Shifts the Polygon to the given position vector.
381
368
  * @name shift
382
369
  * @memberof Polygon
383
- * @function
370
+ * @method
384
371
  * @param {Vector2d} position
385
372
  */
386
373
  /**
387
374
  * Shifts the Polygon to the given x, y position.
388
375
  * @name shift
389
376
  * @memberof Polygon
390
- * @function
391
377
  * @param {number} x
392
378
  * @param {number} y
393
379
  */
@@ -413,7 +399,7 @@ class Polygon {
413
399
  * bounding rect, as the function can be highly consuming with complex shapes)
414
400
  * @name contains
415
401
  * @memberof Polygon
416
- * @function
402
+ * @method
417
403
  * @param {Vector2d} point
418
404
  * @returns {boolean} true if contains
419
405
  */
@@ -424,7 +410,6 @@ class Polygon {
424
410
  * bounding rect, as the function can be highly consuming with complex shapes)
425
411
  * @name contains
426
412
  * @memberof Polygon
427
- * @function
428
413
  * @param {number} x x coordinate
429
414
  * @param {number} y y coordinate
430
415
  * @returns {boolean} true if contains
@@ -462,7 +447,6 @@ class Polygon {
462
447
  * returns the bounding box for this shape, the smallest Rectangle object completely containing this shape.
463
448
  * @name getBounds
464
449
  * @memberof Polygon
465
- * @function
466
450
  * @returns {Bounds} this shape bounding box Rectangle object
467
451
  */
468
452
  getBounds() {
@@ -477,7 +461,6 @@ class Polygon {
477
461
  * @ignore
478
462
  * @name updateBounds
479
463
  * @memberof Polygon
480
- * @function
481
464
  * @returns {Bounds} this shape bounding box Rectangle object
482
465
  */
483
466
  updateBounds() {
@@ -493,7 +476,6 @@ class Polygon {
493
476
  * clone this Polygon
494
477
  * @name clone
495
478
  * @memberof Polygon
496
- * @function
497
479
  * @returns {Polygon} new Polygon
498
480
  */
499
481
  clone() {