melonjs 10.1.0 → 10.2.2

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 (92) hide show
  1. package/README.md +6 -12
  2. package/dist/melonjs.js +3119 -2857
  3. package/dist/melonjs.min.js +3 -3
  4. package/dist/melonjs.module.d.ts +2590 -2490
  5. package/dist/melonjs.module.js +2698 -2470
  6. package/package.json +10 -11
  7. package/src/audio/audio.js +43 -43
  8. package/src/camera/camera2d.js +55 -77
  9. package/src/entity/draggable.js +18 -17
  10. package/src/entity/droptarget.js +19 -18
  11. package/src/entity/entity.js +22 -26
  12. package/src/game.js +3 -3
  13. package/src/index.js +15 -11
  14. package/src/input/gamepad.js +13 -13
  15. package/src/input/input.js +1 -1
  16. package/src/input/keyboard.js +14 -16
  17. package/src/input/pointer.js +42 -35
  18. package/src/input/pointerevent.js +25 -33
  19. package/src/lang/deprecated.js +3 -3
  20. package/src/level/level.js +24 -16
  21. package/src/level/tiled/TMXGroup.js +6 -6
  22. package/src/level/tiled/TMXLayer.js +31 -31
  23. package/src/level/tiled/TMXObject.js +19 -19
  24. package/src/level/tiled/TMXTile.js +11 -12
  25. package/src/level/tiled/TMXTileMap.js +23 -21
  26. package/src/level/tiled/TMXTileset.js +13 -13
  27. package/src/level/tiled/TMXTilesetGroup.js +4 -4
  28. package/src/level/tiled/TMXUtils.js +13 -11
  29. package/src/level/tiled/renderer/TMXHexagonalRenderer.js +1 -1
  30. package/src/level/tiled/renderer/TMXIsometricRenderer.js +1 -1
  31. package/src/level/tiled/renderer/TMXRenderer.js +17 -17
  32. package/src/loader/loader.js +31 -27
  33. package/src/loader/loadingscreen.js +40 -72
  34. package/src/math/color.js +45 -64
  35. package/src/math/math.js +17 -17
  36. package/src/math/matrix2.js +46 -46
  37. package/src/math/matrix3.js +64 -64
  38. package/src/math/observable_vector2.js +45 -57
  39. package/src/math/observable_vector3.js +56 -70
  40. package/src/math/vector2.js +60 -59
  41. package/src/math/vector3.js +65 -64
  42. package/src/particles/emitter.js +53 -55
  43. package/src/particles/particle.js +1 -1
  44. package/src/physics/body.js +45 -51
  45. package/src/physics/bounds.js +36 -36
  46. package/src/physics/collision.js +15 -16
  47. package/src/physics/detector.js +10 -11
  48. package/src/physics/quadtree.js +19 -17
  49. package/src/physics/sat.js +17 -17
  50. package/src/physics/world.js +13 -10
  51. package/src/plugin/plugin.js +6 -6
  52. package/src/renderable/GUI.js +13 -18
  53. package/src/renderable/collectable.js +3 -3
  54. package/src/renderable/colorlayer.js +4 -4
  55. package/src/renderable/container.js +65 -46
  56. package/src/renderable/imagelayer.js +32 -31
  57. package/src/renderable/nineslicesprite.js +211 -0
  58. package/src/renderable/renderable.js +69 -67
  59. package/src/renderable/sprite.js +57 -43
  60. package/src/renderable/trigger.js +14 -15
  61. package/src/shapes/ellipse.js +27 -26
  62. package/src/shapes/line.js +8 -7
  63. package/src/shapes/poly.js +33 -31
  64. package/src/shapes/rectangle.js +50 -96
  65. package/src/state/stage.js +8 -8
  66. package/src/state/state.js +56 -56
  67. package/src/system/device.js +97 -84
  68. package/src/system/event.js +72 -72
  69. package/src/system/pooling.js +14 -14
  70. package/src/system/save.js +6 -3
  71. package/src/system/timer.js +20 -20
  72. package/src/text/bitmaptext.js +27 -33
  73. package/src/text/bitmaptextdata.js +9 -9
  74. package/src/text/text.js +118 -59
  75. package/src/tweens/easing.js +4 -4
  76. package/src/tweens/interpolation.js +4 -4
  77. package/src/tweens/tween.js +37 -27
  78. package/src/utils/agent.js +9 -8
  79. package/src/utils/array.js +4 -4
  80. package/src/utils/file.js +4 -4
  81. package/src/utils/function.js +5 -5
  82. package/src/utils/string.js +12 -12
  83. package/src/utils/utils.js +19 -19
  84. package/src/video/canvas/canvas_renderer.js +90 -90
  85. package/src/video/renderer.js +40 -39
  86. package/src/video/texture.js +85 -76
  87. package/src/video/texture_cache.js +11 -0
  88. package/src/video/video.js +30 -30
  89. package/src/video/webgl/buffer/vertex.js +9 -1
  90. package/src/video/webgl/glshader.js +20 -20
  91. package/src/video/webgl/webgl_compositor.js +47 -37
  92. package/src/video/webgl/webgl_renderer.js +104 -104
@@ -17,6 +17,10 @@ let deviceOrientationInitialized = false;
17
17
 
18
18
  // swipe utility fn & flag
19
19
  let swipeEnabled = true;
20
+
21
+ /**
22
+ * @ignore
23
+ */
20
24
  function _disableSwipeFn(e) {
21
25
  e.preventDefault();
22
26
  if (typeof window.scroll === "function") {
@@ -28,7 +32,10 @@ function _disableSwipeFn(e) {
28
32
  // DOM loading stuff
29
33
  let readyBound = false, isReady = false, readyList = [];
30
34
 
31
- // called to check if the device is ready
35
+ /**
36
+ * // called to check if the device is ready
37
+ * @ignore
38
+ */
32
39
  function _domReady() {
33
40
  // Make sure that the DOM is not already loaded
34
41
  if (!isReady) {
@@ -61,8 +68,10 @@ function _domReady() {
61
68
  // a cache DOMRect object
62
69
  let _domRect = {left: 0, top: 0, x: 0, y: 0, width: 0, height: 0, right: 0, bottom: 0};
63
70
 
64
-
65
- // detect the device type
71
+ /**
72
+ * detect the device type
73
+ * @ignore
74
+ */
66
75
  function _detectDevice() {
67
76
  // iOS Device ?
68
77
  device.iOS = /iPhone|iPad|iPod/i.test(device.ua);
@@ -92,7 +101,10 @@ function _detectDevice() {
92
101
  device.isWeixin = /MicroMessenger/i.test(device.ua);
93
102
  };
94
103
 
95
- // check the device capapbilities
104
+ /**
105
+ * check the device capapbilities
106
+ * @ignore
107
+ */
96
108
  function _checkCapabilities() {
97
109
 
98
110
  // detect device type/platform
@@ -242,7 +254,7 @@ let device = {
242
254
 
243
255
  /**
244
256
  * the `ua` read-only property returns the user agent string for the current browser.
245
- * @type String
257
+ * @type {string}
246
258
  * @readonly
247
259
  * @name ua
248
260
  * @memberOf me.device
@@ -252,7 +264,7 @@ let device = {
252
264
  /**
253
265
  * Browser Local Storage capabilities <br>
254
266
  * (this flag will be set to false if cookies are blocked)
255
- * @type Boolean
267
+ * @type {boolean}
256
268
  * @readonly
257
269
  * @name localStorage
258
270
  * @memberOf me.device
@@ -261,7 +273,7 @@ let device = {
261
273
 
262
274
  /**
263
275
  * Browser accelerometer capabilities
264
- * @type Boolean
276
+ * @type {boolean}
265
277
  * @readonly
266
278
  * @name hasAccelerometer
267
279
  * @memberOf me.device
@@ -270,7 +282,7 @@ let device = {
270
282
 
271
283
  /**
272
284
  * Browser device orientation
273
- * @type Boolean
285
+ * @type {boolean}
274
286
  * @readonly
275
287
  * @name hasDeviceOrientation
276
288
  * @memberOf me.device
@@ -280,7 +292,7 @@ let device = {
280
292
  /**
281
293
  * Supports the ScreenOrientation API
282
294
  * @see https://developer.mozilla.org/en-US/docs/Web/API/ScreenOrientation/onchange
283
- * @type Boolean
295
+ * @type {boolean}
284
296
  * @readonly
285
297
  * @name ScreenOrientation
286
298
  * @memberOf me.device
@@ -289,16 +301,16 @@ let device = {
289
301
 
290
302
  /**
291
303
  * Browser full screen support
292
- * @type Boolean
304
+ * @type {boolean}
293
305
  * @readonly
294
306
  * @name hasFullscreenSupport
295
307
  * @memberOf me.device
296
308
  */
297
309
  hasFullscreenSupport : false,
298
310
 
299
- /**
311
+ /**
300
312
  * Browser pointerlock api support
301
- * @type Boolean
313
+ * @type {boolean}
302
314
  * @readonly
303
315
  * @name hasPointerLockSupport
304
316
  * @memberOf me.device
@@ -306,17 +318,17 @@ let device = {
306
318
  hasPointerLockSupport : false,
307
319
 
308
320
  /**
309
- * Device WebAudio Support
310
- * @type Boolean
311
- * @readonly
312
- * @name hasWebAudio
313
- * @memberOf me.device
314
- */
315
- hasWebAudio : false,
321
+ * Device WebAudio Support
322
+ * @type {boolean}
323
+ * @readonly
324
+ * @name hasWebAudio
325
+ * @memberOf me.device
326
+ */
327
+ hasWebAudio : false,
316
328
 
317
329
  /**
318
330
  * Browser Base64 decoding capability
319
- * @type Boolean
331
+ * @type {boolean}
320
332
  * @readonly
321
333
  * @name nativeBase64
322
334
  * @memberOf me.device
@@ -325,7 +337,7 @@ let device = {
325
337
 
326
338
  /**
327
339
  * Return the maximum number of simultaneous touch contact points are supported by the current device.
328
- * @type Number
340
+ * @type {number}
329
341
  * @readonly
330
342
  * @name maxTouchPoints
331
343
  * @memberOf me.device
@@ -338,7 +350,7 @@ let device = {
338
350
 
339
351
  /**
340
352
  * Touch capabilities
341
- * @type Boolean
353
+ * @type {boolean}
342
354
  * @readonly
343
355
  * @name touch
344
356
  * @memberOf me.device
@@ -347,7 +359,7 @@ let device = {
347
359
 
348
360
  /**
349
361
  * W3C standard wheel events
350
- * @type Boolean
362
+ * @type {boolean}
351
363
  * @readonly
352
364
  * @name wheel
353
365
  * @memberOf me.device
@@ -357,7 +369,7 @@ let device = {
357
369
  /**
358
370
  * equals to true if a mobile device <br>
359
371
  * (Android | iPhone | iPad | iPod | BlackBerry | Windows Phone | Kindle)
360
- * @type Boolean
372
+ * @type {boolean}
361
373
  * @readonly
362
374
  * @name isMobile
363
375
  * @memberOf me.device
@@ -366,7 +378,7 @@ let device = {
366
378
 
367
379
  /**
368
380
  * equals to true if the device is an iOS platform.
369
- * @type Boolean
381
+ * @type {boolean}
370
382
  * @readonly
371
383
  * @name iOS
372
384
  * @memberOf me.device
@@ -375,7 +387,7 @@ let device = {
375
387
 
376
388
  /**
377
389
  * equals to true if the device is an Android platform.
378
- * @type Boolean
390
+ * @type {boolean}
379
391
  * @readonly
380
392
  * @name android
381
393
  * @memberOf me.device
@@ -384,7 +396,7 @@ let device = {
384
396
 
385
397
  /**
386
398
  * equals to true if the device is an Android 2.x platform.
387
- * @type Boolean
399
+ * @type {boolean}
388
400
  * @readonly
389
401
  * @name android2
390
402
  * @memberOf me.device
@@ -393,7 +405,7 @@ let device = {
393
405
 
394
406
  /**
395
407
  * equals to true if the device is a Linux platform.
396
- * @type Boolean
408
+ * @type {boolean}
397
409
  * @readonly
398
410
  * @name linux
399
411
  * @memberOf me.device
@@ -402,7 +414,7 @@ let device = {
402
414
 
403
415
  /**
404
416
  * equals to true if the game is running under Ejecta.
405
- * @type Boolean
417
+ * @type {boolean}
406
418
  * @readonly
407
419
  * @see http://impactjs.com/ejecta
408
420
  * @name ejecta
@@ -412,7 +424,7 @@ let device = {
412
424
 
413
425
  /**
414
426
  * equals to true if the game is running under Wechat.
415
- * @type Boolean
427
+ * @type {boolean}
416
428
  * @readonly
417
429
  * @name isWeixin
418
430
  * @memberOf me.device
@@ -421,16 +433,16 @@ let device = {
421
433
 
422
434
  /**
423
435
  * equals to true if the device is running on ChromeOS.
424
- * @type Boolean
436
+ * @type {boolean}
425
437
  * @readonly
426
438
  * @name chromeOS
427
439
  * @memberOf me.device
428
440
  */
429
441
  chromeOS : false,
430
442
 
431
- /**
443
+ /**
432
444
  * equals to true if the device is a Windows Phone platform.
433
- * @type Boolean
445
+ * @type {boolean}
434
446
  * @readonly
435
447
  * @name wp
436
448
  * @memberOf me.device
@@ -439,7 +451,7 @@ let device = {
439
451
 
440
452
  /**
441
453
  * equals to true if the device is a BlackBerry platform.
442
- * @type Boolean
454
+ * @type {boolean}
443
455
  * @readonly
444
456
  * @name BlackBerry
445
457
  * @memberOf me.device
@@ -448,7 +460,7 @@ let device = {
448
460
 
449
461
  /**
450
462
  * equals to true if the device is a Kindle platform.
451
- * @type Boolean
463
+ * @type {boolean}
452
464
  * @readonly
453
465
  * @name Kindle
454
466
  * @memberOf me.device
@@ -458,7 +470,7 @@ let device = {
458
470
  /**
459
471
  * contains the g-force acceleration along the x-axis.
460
472
  * @public
461
- * @type Number
473
+ * @type {number}
462
474
  * @readonly
463
475
  * @name accelerationX
464
476
  * @see me.device.watchAccelerometer
@@ -469,7 +481,7 @@ let device = {
469
481
  /**
470
482
  * contains the g-force acceleration along the y-axis.
471
483
  * @public
472
- * @type Number
484
+ * @type {number}
473
485
  * @readonly
474
486
  * @name accelerationY
475
487
  * @see me.device.watchAccelerometer
@@ -480,7 +492,7 @@ let device = {
480
492
  /**
481
493
  * contains the g-force acceleration along the z-axis.
482
494
  * @public
483
- * @type Number
495
+ * @type {number}
484
496
  * @readonly
485
497
  * @name accelerationZ
486
498
  * @see me.device.watchAccelerometer
@@ -491,7 +503,7 @@ let device = {
491
503
  /**
492
504
  * Device orientation Gamma property. Gives angle on tilting a portrait held phone left or right
493
505
  * @public
494
- * @type Number
506
+ * @type {number}
495
507
  * @readonly
496
508
  * @name gamma
497
509
  * @see me.device.watchDeviceOrientation
@@ -502,7 +514,7 @@ let device = {
502
514
  /**
503
515
  * Device orientation Beta property. Gives angle on tilting a portrait held phone forward or backward
504
516
  * @public
505
- * @type Number
517
+ * @type {number}
506
518
  * @readonly
507
519
  * @name beta
508
520
  * @see me.device.watchDeviceOrientation
@@ -514,7 +526,7 @@ let device = {
514
526
  * Device orientation Alpha property. Gives angle based on the rotation of the phone around its z axis.
515
527
  * The z-axis is perpendicular to the phone, facing out from the center of the screen.
516
528
  * @public
517
- * @type Number
529
+ * @type {number}
518
530
  * @readonly
519
531
  * @name alpha
520
532
  * @see me.device.watchDeviceOrientation
@@ -526,7 +538,7 @@ let device = {
526
538
  * a string representing the preferred language of the user, usually the language of the browser UI.
527
539
  * (will default to "en" if the information is not available)
528
540
  * @public
529
- * @type String
541
+ * @type {string}
530
542
  * @readonly
531
543
  * @see http://www.w3schools.com/tags/ref_language_codes.asp
532
544
  * @name language
@@ -536,7 +548,7 @@ let device = {
536
548
 
537
549
  /**
538
550
  * Specify whether to pause the game when losing focus
539
- * @type {Boolean}
551
+ * @type {boolean}
540
552
  * @default true
541
553
  * @memberOf me.device
542
554
  */
@@ -544,7 +556,7 @@ let device = {
544
556
 
545
557
  /**
546
558
  * Specify whether to unpause the game when gaining focus
547
- * @type {Boolean}
559
+ * @type {boolean}
548
560
  * @default true
549
561
  * @memberOf me.device
550
562
  */
@@ -552,7 +564,7 @@ let device = {
552
564
 
553
565
  /**
554
566
  * Specify whether to automatically bring the window to the front
555
- * @type {Boolean}
567
+ * @type {boolean}
556
568
  * @default true
557
569
  * @memberOf me.device
558
570
  */
@@ -561,7 +573,7 @@ let device = {
561
573
  /**
562
574
  * Specify whether to stop the game when losing focus or not.
563
575
  * The engine restarts on focus if this is enabled.
564
- * @type {Boolean}
576
+ * @type {boolean}
565
577
  * @default false
566
578
  * @memberOf me.device
567
579
  */
@@ -569,7 +581,7 @@ let device = {
569
581
 
570
582
  /**
571
583
  * equals to true if the device browser supports OffScreenCanvas.
572
- * @type Boolean
584
+ * @type {boolean}
573
585
  * @readonly
574
586
  * @name OffScreenCanvas
575
587
  * @memberOf me.device
@@ -653,7 +665,7 @@ let device = {
653
665
  /**
654
666
  * enable/disable swipe on WebView.
655
667
  * @function me.device.enableSwipe
656
- * @param {Boolean} [enable=true] enable or disable swipe.
668
+ * @param {boolean} [enable=true] enable or disable swipe.
657
669
  */
658
670
  enableSwipe(enable) {
659
671
  if (enable !== false) {
@@ -670,7 +682,7 @@ let device = {
670
682
  /**
671
683
  * Triggers a fullscreen request. Requires fullscreen support from the browser/device.
672
684
  * @function me.device.requestFullscreen
673
- * @param {Object} [element=default canvas object] the element to be set in full-screen mode.
685
+ * @param {object} [element=default canvas object] the element to be set in full-screen mode.
674
686
  * @example
675
687
  * // add a keyboard shortcut to toggle Fullscreen mode on/off
676
688
  * me.input.bindKey(me.input.KEY.F, "toggleFullscreen");
@@ -710,7 +722,7 @@ let device = {
710
722
  * It can be "any", "natural", "landscape", "portrait", "portrait-primary", "portrait-secondary", "landscape-primary", "landscape-secondary"
711
723
  * @function me.device.getScreenOrientation
712
724
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Screen/orientation
713
- * @return {String} the screen orientation
725
+ * @returns {string} the screen orientation
714
726
  */
715
727
  getScreenOrientation() {
716
728
  var PORTRAIT = "portrait";
@@ -744,14 +756,15 @@ let device = {
744
756
  * This method only works for installed Web apps or for Web pages in full-screen mode.
745
757
  * @function me.device.lockOrientation
746
758
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Screen/lockOrientation
747
- * @return {Boolean} true if the orientation was unsuccessfully locked
759
+ * @param {string|string[]} orientation The orientation into which to lock the screen.
760
+ * @returns {boolean} true if the orientation was unsuccessfully locked
748
761
  */
749
762
  lockOrientation(orientation) {
750
763
  var screen = window.screen;
751
764
  if (typeof screen !== "undefined") {
752
- var lockOrientation = prefixed("lockOrientation", screen);
753
- if (typeof lockOrientation !== "undefined") {
754
- return lockOrientation(orientation);
765
+ var _lockOrientation = prefixed("lockOrientation", screen);
766
+ if (typeof _lockOrientation !== "undefined") {
767
+ return _lockOrientation(orientation);
755
768
  }
756
769
  }
757
770
  return false;
@@ -762,14 +775,14 @@ let device = {
762
775
  * This method only works for installed Web apps or for Web pages in full-screen mode.
763
776
  * @function me.device.unlockOrientation
764
777
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Screen/lockOrientation
765
- * @return {Boolean} true if the orientation was unsuccessfully unlocked
778
+ * @returns {boolean} true if the orientation was unsuccessfully unlocked
766
779
  */
767
- unlockOrientation(orientation) {
780
+ unlockOrientation() {
768
781
  var screen = window.screen;
769
782
  if (typeof screen !== "undefined") {
770
- var unlockOrientation = prefixed("unlockOrientation", screen);
771
- if (typeof unlockOrientation !== "undefined") {
772
- return unlockOrientation(orientation);
783
+ var _unlockOrientation = prefixed("unlockOrientation", screen);
784
+ if (typeof _unlockOrientation !== "undefined") {
785
+ return _unlockOrientation();
773
786
  }
774
787
  }
775
788
  return false;
@@ -778,7 +791,7 @@ let device = {
778
791
  /**
779
792
  * return true if the device screen orientation is in Portrait mode
780
793
  * @function me.device.isPortrait
781
- * @return {Boolean}
794
+ * @returns {boolean}
782
795
  */
783
796
  isPortrait() {
784
797
  return this.getScreenOrientation().includes("portrait");
@@ -787,7 +800,7 @@ let device = {
787
800
  /**
788
801
  * return true if the device screen orientation is in Portrait mode
789
802
  * @function me.device.isLandscape
790
- * @return {Boolean}
803
+ * @returns {boolean}
791
804
  */
792
805
  isLandscape() {
793
806
  return this.getScreenOrientation().includes("landscape");
@@ -797,8 +810,8 @@ let device = {
797
810
  * return the device storage
798
811
  * @function me.device.getStorage
799
812
  * @see me.save
800
- * @param {String} [type="local"]
801
- * @return {Object} a reference to the device storage
813
+ * @param {string} [type="local"]
814
+ * @returns {object} a reference to the device storage
802
815
  */
803
816
  getStorage(type = "local") {
804
817
  switch (type) {
@@ -813,8 +826,8 @@ let device = {
813
826
  /**
814
827
  * return the parent DOM element for the given parent name or HTMLElement object
815
828
  * @function me.device.getParentElement
816
- * @param {String|HTMLElement} element the parent element name or a HTMLElement object
817
- * @return {HTMLElement} the parent Element
829
+ * @param {string|HTMLElement} element the parent element name or a HTMLElement object
830
+ * @returns {HTMLElement} the parent Element
818
831
  */
819
832
  getParentElement(element) {
820
833
  var target = this.getElement(element);
@@ -829,8 +842,8 @@ let device = {
829
842
  /**
830
843
  * return the DOM element for the given element name or HTMLElement object
831
844
  * @function me.device.getElement
832
- * @param {String|HTMLElement} element the parent element name or a HTMLElement object
833
- * @return {HTMLElement} the corresponding DOM Element or null if not existing
845
+ * @param {string|HTMLElement} element the parent element name or a HTMLElement object
846
+ * @returns {HTMLElement} the corresponding DOM Element or null if not existing
834
847
  */
835
848
  getElement(element) {
836
849
  var target = null;
@@ -857,8 +870,8 @@ let device = {
857
870
  * <br><img src="images/element-box-diagram.png"/>
858
871
  * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMRect
859
872
  * @function me.device.getElementBounds
860
- * @param {String|HTMLElement} element an HTMLElement object
861
- * @return {DOMRect} the size and position of the element relatively to the viewport
873
+ * @param {string|HTMLElement} element an HTMLElement object
874
+ * @returns {DOMRect} the size and position of the element relatively to the viewport
862
875
  */
863
876
  getElementBounds(element) {
864
877
  if (typeof element === "object" && element !== document.body && typeof element.getBoundingClientRect !== "undefined") {
@@ -875,8 +888,8 @@ let device = {
875
888
  * <br><img src="images/element-box-diagram.png"/>
876
889
  * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMRect
877
890
  * @function me.device.getParentBounds
878
- * @param {String|HTMLElement} element an HTMLElement object
879
- * @return {DOMRect} the size and position of the given element parent relative to the viewport
891
+ * @param {string|HTMLElement} element an HTMLElement object
892
+ * @returns {DOMRect} the size and position of the given element parent relative to the viewport
880
893
  */
881
894
  getParentBounds(element) {
882
895
  return this.getElementBounds(this.getParentElement(element));
@@ -885,9 +898,9 @@ let device = {
885
898
  /**
886
899
  * returns true if the device supports WebGL
887
900
  * @function me.device.isWebGLSupported
888
- * @param {Object} [options] context creation options
889
- * @param {Boolean} [options.failIfMajorPerformanceCaveat=true] If true, the renderer will switch to CANVAS mode if the performances of a WebGL context would be dramatically lower than that of a native application making equivalent OpenGL calls.
890
- * @return {Boolean} true if WebGL is supported
901
+ * @param {object} [options] context creation options
902
+ * @param {boolean} [options.failIfMajorPerformanceCaveat=true] If true, the renderer will switch to CANVAS mode if the performances of a WebGL context would be dramatically lower than that of a native application making equivalent OpenGL calls.
903
+ * @returns {boolean} true if WebGL is supported
891
904
  */
892
905
  isWebGLSupported(options) {
893
906
  var _supported = false;
@@ -909,7 +922,7 @@ let device = {
909
922
  * return the highest precision format supported by this device for GL Shaders
910
923
  * @function me.device.getMaxShaderPrecision
911
924
  * @param {WebGLRenderingContext} gl
912
- * @return {Boolean} "lowp", "mediump", or "highp"
925
+ * @returns {boolean} "lowp", "mediump", or "highp"
913
926
  */
914
927
  getMaxShaderPrecision(gl) {
915
928
  if (gl.getShaderPrecisionFormat(gl.VERTEX_SHADER, gl.HIGH_FLOAT ).precision > 0 &&
@@ -1020,7 +1033,7 @@ let device = {
1020
1033
  * @see me.device.accelerationX
1021
1034
  * @see me.device.accelerationY
1022
1035
  * @see me.device.accelerationZ
1023
- * @return {Boolean} false if not supported or permission not granted by the user
1036
+ * @returns {boolean} false if not supported or permission not granted by the user
1024
1037
  * @example
1025
1038
  * // try to enable device accelerometer event on user gesture
1026
1039
  * me.input.registerPointerEvent("pointerleave", me.game.viewport, function() {
@@ -1071,7 +1084,7 @@ let device = {
1071
1084
  * @see me.device.alpha
1072
1085
  * @see me.device.beta
1073
1086
  * @see me.device.gamma
1074
- * @return {Boolean} false if not supported or permission not granted by the user
1087
+ * @returns {boolean} false if not supported or permission not granted by the user
1075
1088
  * @example
1076
1089
  * // try to enable device orientation event on user gesture
1077
1090
  * me.input.registerPointerEvent("pointerleave", me.game.viewport, function() {
@@ -1118,7 +1131,7 @@ let device = {
1118
1131
  * If a vibration pattern is already in progress when this method is called,
1119
1132
  * the previous pattern is halted and the new one begins instead.
1120
1133
  * @function me.device.vibrate
1121
- * @param {Number|Number[]} pattern pattern of vibration and pause intervals
1134
+ * @param {number|number[]} pattern pattern of vibration and pause intervals
1122
1135
  * @example
1123
1136
  * // vibrate for 1000 ms
1124
1137
  * me.device.vibrate(1000);
@@ -1142,9 +1155,9 @@ let device = {
1142
1155
  * @name devicePixelRatio
1143
1156
  * @memberOf me.device
1144
1157
  * @public
1145
- * @type {Number}
1158
+ * @type {number}
1146
1159
  * @readonly
1147
- * @return {Number}
1160
+ * @returns {number}
1148
1161
  */
1149
1162
  Object.defineProperty(device, "devicePixelRatio", {
1150
1163
  /**
@@ -1160,9 +1173,9 @@ Object.defineProperty(device, "devicePixelRatio", {
1160
1173
  * @name isFullscreen
1161
1174
  * @memberOf me.device
1162
1175
  * @public
1163
- * @type {Boolean}
1176
+ * @type {boolean}
1164
1177
  * @readonly
1165
- * @return {Boolean}
1178
+ * @returns {boolean}
1166
1179
  */
1167
1180
  Object.defineProperty(device, "isFullscreen", {
1168
1181
  /**
@@ -1183,9 +1196,9 @@ Object.defineProperty(device, "isFullscreen", {
1183
1196
  * @name sound
1184
1197
  * @memberOf me.device
1185
1198
  * @public
1186
- * @type {Boolean}
1199
+ * @type {boolean}
1187
1200
  * @readonly
1188
- * @return {Boolean}
1201
+ * @returns {boolean}
1189
1202
  */
1190
1203
  Object.defineProperty(device, "sound", {
1191
1204
  /**