melonjs 10.2.1 → 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 (90) hide show
  1. package/README.md +1 -1
  2. package/dist/melonjs.js +2735 -2760
  3. package/dist/melonjs.min.js +3 -3
  4. package/dist/melonjs.module.d.ts +2186 -2162
  5. package/dist/melonjs.module.js +2323 -2362
  6. package/package.json +8 -9
  7. package/src/audio/audio.js +43 -43
  8. package/src/camera/camera2d.js +52 -74
  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 +2 -2
  13. package/src/index.js +11 -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 +18 -26
  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 +29 -25
  33. package/src/math/color.js +45 -64
  34. package/src/math/math.js +17 -17
  35. package/src/math/matrix2.js +46 -46
  36. package/src/math/matrix3.js +64 -64
  37. package/src/math/observable_vector2.js +45 -57
  38. package/src/math/observable_vector3.js +56 -70
  39. package/src/math/vector2.js +60 -59
  40. package/src/math/vector3.js +65 -64
  41. package/src/particles/emitter.js +53 -55
  42. package/src/particles/particle.js +1 -1
  43. package/src/physics/body.js +44 -44
  44. package/src/physics/bounds.js +34 -34
  45. package/src/physics/collision.js +15 -16
  46. package/src/physics/detector.js +10 -10
  47. package/src/physics/quadtree.js +19 -17
  48. package/src/physics/sat.js +17 -17
  49. package/src/physics/world.js +12 -10
  50. package/src/plugin/plugin.js +6 -6
  51. package/src/renderable/GUI.js +13 -18
  52. package/src/renderable/collectable.js +3 -3
  53. package/src/renderable/colorlayer.js +4 -4
  54. package/src/renderable/container.js +64 -46
  55. package/src/renderable/imagelayer.js +30 -31
  56. package/src/renderable/nineslicesprite.js +13 -13
  57. package/src/renderable/renderable.js +68 -66
  58. package/src/renderable/sprite.js +57 -43
  59. package/src/renderable/trigger.js +14 -15
  60. package/src/shapes/ellipse.js +27 -26
  61. package/src/shapes/line.js +8 -7
  62. package/src/shapes/poly.js +33 -31
  63. package/src/shapes/rectangle.js +50 -96
  64. package/src/state/stage.js +6 -6
  65. package/src/state/state.js +54 -54
  66. package/src/system/device.js +97 -84
  67. package/src/system/event.js +72 -72
  68. package/src/system/pooling.js +14 -14
  69. package/src/system/save.js +6 -3
  70. package/src/system/timer.js +20 -20
  71. package/src/text/bitmaptext.js +27 -33
  72. package/src/text/bitmaptextdata.js +9 -9
  73. package/src/text/text.js +39 -41
  74. package/src/tweens/easing.js +4 -4
  75. package/src/tweens/interpolation.js +4 -4
  76. package/src/tweens/tween.js +37 -27
  77. package/src/utils/agent.js +9 -8
  78. package/src/utils/array.js +4 -4
  79. package/src/utils/file.js +4 -4
  80. package/src/utils/function.js +5 -5
  81. package/src/utils/string.js +12 -12
  82. package/src/utils/utils.js +19 -19
  83. package/src/video/canvas/canvas_renderer.js +90 -90
  84. package/src/video/renderer.js +40 -39
  85. package/src/video/texture.js +74 -75
  86. package/src/video/video.js +30 -30
  87. package/src/video/webgl/buffer/vertex.js +9 -1
  88. package/src/video/webgl/glshader.js +20 -20
  89. package/src/video/webgl/webgl_compositor.js +33 -34
  90. package/src/video/webgl/webgl_renderer.js +104 -104
@@ -2,15 +2,15 @@ import * as event from "./../system/event.js";
2
2
  import Entity from "./entity.js";
3
3
 
4
4
  /**
5
- * Used to make a game entity a droptarget
6
- * @class
7
- * @extends me.Entity
8
- * @memberOf me
9
- * @constructor
10
- * @param {Number} x the x coordinates of the entity object
11
- * @param {Number} y the y coordinates of the entity object
12
- * @param {Object} settings Entity properties (see {@link me.Entity})
13
- */
5
+ * Used to make a game entity a droptarget
6
+ * @class
7
+ * @extends me.Entity
8
+ * @memberOf me
9
+ * @constructor
10
+ * @param {number} x the x coordinates of the entity object
11
+ * @param {number} y the y coordinates of the entity object
12
+ * @param {object} settings Entity properties (see {@link me.Entity})
13
+ */
14
14
 
15
15
  class DroptargetEntity extends Entity {
16
16
  /**
@@ -18,9 +18,9 @@ class DroptargetEntity extends Entity {
18
18
  * @name init
19
19
  * @memberOf me.DroptargetEntity
20
20
  * @function
21
- * @param {Number} x the x postion of the entity
22
- * @param {Number} y the y postion of the entity
23
- * @param {Object} settings the additional entity settings
21
+ * @param {number} x the x postion of the entity
22
+ * @param {number} y the y postion of the entity
23
+ * @param {object} settings the additional entity settings
24
24
  */
25
25
  constructor(x, y, settings) {
26
26
  super(x, y, settings);
@@ -28,7 +28,7 @@ class DroptargetEntity extends Entity {
28
28
  * constant for the overlaps method
29
29
  * @public
30
30
  * @constant
31
- * @type String
31
+ * @type {string}
32
32
  * @name CHECKMETHOD_OVERLAP
33
33
  * @memberOf me.DroptargetEntity
34
34
  */
@@ -37,7 +37,7 @@ class DroptargetEntity extends Entity {
37
37
  * constant for the contains method
38
38
  * @public
39
39
  * @constant
40
- * @type String
40
+ * @type {string}
41
41
  * @name CHECKMETHOD_CONTAINS
42
42
  * @memberOf me.DroptargetEntity
43
43
  */
@@ -46,7 +46,7 @@ class DroptargetEntity extends Entity {
46
46
  * the checkmethod we want to use
47
47
  * @public
48
48
  * @constant
49
- * @type String
49
+ * @type {string}
50
50
  * @name checkMethod
51
51
  * @memberOf me.DroptargetEntity
52
52
  */
@@ -60,7 +60,7 @@ class DroptargetEntity extends Entity {
60
60
  * @name setCheckMethod
61
61
  * @memberOf me.DroptargetEntity
62
62
  * @function
63
- * @param {Constant} checkMethod the checkmethod (defaults to CHECKMETHOD_OVERLAP)
63
+ * @param {string} checkMethod the checkmethod (defaults to CHECKMETHOD_OVERLAP)
64
64
  */
65
65
  setCheckMethod(checkMethod) {
66
66
  // We can improve this check,
@@ -75,7 +75,8 @@ class DroptargetEntity extends Entity {
75
75
  * @name checkOnMe
76
76
  * @memberOf me.DroptargetEntity
77
77
  * @function
78
- * @param {Object} draggableEntity the draggable entity that is dropped
78
+ * @param {object} e the triggering event
79
+ * @param {object} draggableEntity the draggable entity that is dropped
79
80
  */
80
81
  checkOnMe(e, draggableEntity) {
81
82
  if (draggableEntity && this.checkMethod(draggableEntity.getBounds())) {
@@ -89,7 +90,7 @@ class DroptargetEntity extends Entity {
89
90
  * @name drop
90
91
  * @memberOf me.DroptargetEntity
91
92
  * @function
92
- * @param {Object} draggableEntity the draggable entity that is dropped
93
+ * @param {object} draggableEntity the draggable entity that is dropped
93
94
  */
94
95
  drop() {
95
96
 
@@ -12,20 +12,20 @@ import Polygon from "./../shapes/poly.js";
12
12
  * @memberOf me
13
13
  * @see me.Renderable
14
14
  * @constructor
15
- * @param {Number} x the x coordinates of the entity object
16
- * @param {Number} y the y coordinates of the entity object
17
- * @param {Object} settings Entity properties, to be defined through Tiled or when calling the entity constructor
15
+ * @param {number} x the x coordinates of the entity object
16
+ * @param {number} y the y coordinates of the entity object
17
+ * @param {object} settings Entity properties, to be defined through Tiled or when calling the entity constructor
18
18
  * <img src="images/object_properties.png"/>
19
- * @param {Number} settings.width the physical width the entity takes up in game
20
- * @param {Number} settings.height the physical height the entity takes up in game
21
- * @param {String} [settings.name] object entity name
22
- * @param {String} [settings.id] object unique IDs
23
- * @param {Image|String} [settings.image] resource name of a spritesheet to use for the entity renderable component
19
+ * @param {number} settings.width the physical width the entity takes up in game
20
+ * @param {number} settings.height the physical height the entity takes up in game
21
+ * @param {string} [settings.name] object entity name
22
+ * @param {string} [settings.id] object unique IDs
23
+ * @param {Image|string} [settings.image] resource name of a spritesheet to use for the entity renderable component
24
24
  * @param {me.Vector2d} [settings.anchorPoint=0.0] Entity anchor point
25
- * @param {Number} [settings.framewidth=settings.width] width of a single frame in the given spritesheet
26
- * @param {Number} [settings.frameheight=settings.width] height of a single frame in the given spritesheet
27
- * @param {String} [settings.type] object type
28
- * @param {Number} [settings.collisionMask] Mask collision detection for this object
25
+ * @param {number} [settings.framewidth=settings.width] width of a single frame in the given spritesheet
26
+ * @param {number} [settings.frameheight=settings.width] height of a single frame in the given spritesheet
27
+ * @param {string} [settings.type] object type
28
+ * @param {number} [settings.collisionMask] Mask collision detection for this object
29
29
  * @param {me.Rect[]|me.Polygon[]|me.Line[]|me.Ellipse[]} [settings.shapes] the initial list of collision shapes (usually populated through Tiled)
30
30
  */
31
31
 
@@ -74,7 +74,7 @@ class Entity extends Renderable {
74
74
  /**
75
75
  * object type (as defined in Tiled)
76
76
  * @public
77
- * @type String
77
+ * @type {string}
78
78
  * @name type
79
79
  * @memberOf me.Entity
80
80
  */
@@ -83,7 +83,7 @@ class Entity extends Renderable {
83
83
  /**
84
84
  * object unique ID (as defined in Tiled)
85
85
  * @public
86
- * @type Number
86
+ * @type {number}
87
87
  * @name id
88
88
  * @memberOf me.Entity
89
89
  */
@@ -93,7 +93,7 @@ class Entity extends Renderable {
93
93
  * dead/living state of the entity<br>
94
94
  * default value : true
95
95
  * @public
96
- * @type Boolean
96
+ * @type {boolean}
97
97
  * @name alive
98
98
  * @memberOf me.Entity
99
99
  */
@@ -102,7 +102,7 @@ class Entity extends Renderable {
102
102
  /**
103
103
  * the entity body object
104
104
  * @public
105
- * @type me.Body
105
+ * @type {me.Body}
106
106
  * @name body
107
107
  * @memberOf me.Entity
108
108
  */
@@ -134,20 +134,15 @@ class Entity extends Renderable {
134
134
  /**
135
135
  * The entity renderable component (can be any objects deriving from me.Renderable, like me.Sprite for example)
136
136
  * @public
137
- * @type me.Renderable
137
+ * @type {me.Renderable}
138
138
  * @name renderable
139
139
  * @memberOf me.Entity
140
140
  */
141
141
 
142
- /**
143
- * @ignore
144
- */
145
142
  get renderable() {
146
143
  return this.children[0];
147
144
  }
148
- /**
149
- * @ignore
150
- */
145
+
151
146
  set renderable(value) {
152
147
  if (value instanceof Renderable) {
153
148
  this.children[0] = value;
@@ -167,10 +162,11 @@ class Entity extends Renderable {
167
162
 
168
163
  /**
169
164
  * update the bounds position when the body is modified
170
- * @private
165
+ * @ignore
171
166
  * @name onBodyUpdate
172
167
  * @memberOf me.Entity
173
168
  * @function
169
+ * @param {me.Body} the body whose bounds to update
174
170
  */
175
171
  onBodyUpdate(body) {
176
172
  // update the entity bounds to include the body bounds
@@ -208,8 +204,8 @@ class Entity extends Renderable {
208
204
  * @function
209
205
  * @protected
210
206
  * @param {me.CanvasRenderer|me.WebGLRenderer} renderer a renderer object
211
- * @param {me.Rect} region to draw
212
- **/
207
+ * @param {me.Rect} rect region to draw
208
+ */
213
209
  draw(renderer, rect) {
214
210
  var renderable = this.renderable;
215
211
  if (renderable instanceof Renderable) {
package/src/game.js CHANGED
@@ -151,7 +151,7 @@ export function updateFrameRate() {
151
151
  * Returns the parent container of the specified Child in the game world
152
152
  * @function me.game.getParentContainer
153
153
  * @param {me.Renderable} child
154
- * @return {me.Container}
154
+ * @returns {me.Container}
155
155
  */
156
156
  export function getParentContainer(child) {
157
157
  return child.ancestor;
@@ -170,7 +170,7 @@ export function repaint() {
170
170
  * update all objects of the game manager
171
171
  * @ignore
172
172
  * @function me.game.update
173
- * @param {Number} time current timestamp as provided by the RAF callback
173
+ * @param {number} time current timestamp as provided by the RAF callback
174
174
  * @param {me.Stage} stage the current stage
175
175
  */
176
176
  export function update(time, stage) {
package/src/index.js CHANGED
@@ -79,10 +79,10 @@ import DroptargetEntity from "./entity/droptarget.js";
79
79
  import * as deprecated from "./lang/deprecated.js";
80
80
 
81
81
  /**
82
- * (<b>m</b>)elonJS (<b>e</b>)ngine : All melonJS functions are defined inside this namespace.
83
- * You generally should not add new properties to this namespace as it may be overwritten in future versions.
84
- * @namespace me
85
- */
82
+ * (<b>m</b>)elonJS (<b>e</b>)ngine : All melonJS functions are defined inside this namespace.
83
+ * You generally should not add new properties to this namespace as it may be overwritten in future versions.
84
+ * @namespace me
85
+ */
86
86
 
87
87
  /**
88
88
  * current melonJS version
@@ -181,17 +181,17 @@ export {
181
181
 
182
182
 
183
183
  /**
184
- * a flag indicating that melonJS is fully initialized
185
- * @type {Boolean}
186
- * @default false
187
- * @readonly
188
- * @memberOf me
189
- */
184
+ * a flag indicating that melonJS is fully initialized
185
+ * @type {boolean}
186
+ * @default false
187
+ * @readonly
188
+ * @memberOf me
189
+ */
190
190
  export var initialized = false;
191
191
 
192
192
  /**
193
193
  * disable melonJS auto-initialization
194
- * @type {Boolean}
194
+ * @type {boolean}
195
195
  * @default false
196
196
  * @see me.boot
197
197
  * @memberOf me
@@ -296,7 +296,7 @@ export var GAMEPAD = {
296
296
  * </ul>
297
297
  * @public
298
298
  * @name AXES
299
- * @enum {Number}
299
+ * @enum {number}
300
300
  * @memberOf me.input.GAMEPAD
301
301
  * @see https://w3c.github.io/gamepad/#remapping
302
302
  */
@@ -323,7 +323,7 @@ export var GAMEPAD = {
323
323
  * </ul>
324
324
  * @public
325
325
  * @name BUTTONS
326
- * @enum {Number}
326
+ * @enum {number}
327
327
  * @memberOf me.input.GAMEPAD
328
328
  * @see https://w3c.github.io/gamepad/#remapping
329
329
  */
@@ -360,11 +360,11 @@ export var GAMEPAD = {
360
360
  * @memberOf me.input
361
361
  * @public
362
362
  * @function
363
- * @param {Number} index Gamepad index
364
- * @param {Object} button Button/Axis definition
365
- * @param {String} button.type "buttons" or "axes"
363
+ * @param {number} index Gamepad index
364
+ * @param {object} button Button/Axis definition
365
+ * @param {string} button.type "buttons" or "axes"
366
366
  * @param {me.input.GAMEPAD.BUTTONS|me.input.GAMEPAD.AXES} button.code button or axis code id
367
- * @param {Number} [button.threshold=1] value indicating when the axis should trigger the keycode (e.g. -0.5 or 0.5)
367
+ * @param {number} [button.threshold=1] value indicating when the axis should trigger the keycode (e.g. -0.5 or 0.5)
368
368
  * @param {me.input.KEY} keyCode
369
369
  * @example
370
370
  * // enable the keyboard
@@ -435,7 +435,7 @@ export function bindGamepad(index, button, keyCode) {
435
435
  * @memberOf me.input
436
436
  * @public
437
437
  * @function
438
- * @param {Number} index Gamepad index
438
+ * @param {number} index Gamepad index
439
439
  * @param {me.input.GAMEPAD.BUTTONS} button
440
440
  * @example
441
441
  * me.input.unbindGamepad(0, me.input.GAMEPAD.BUTTONS.FACE_1);
@@ -454,7 +454,7 @@ export function unbindGamepad(index, button) {
454
454
  * @memberOf me.input
455
455
  * @public
456
456
  * @function
457
- * @param {Number} value Deadzone value
457
+ * @param {number} value Deadzone value
458
458
  */
459
459
  export function setGamepadDeadzone(value) {
460
460
  deadzone = value;
@@ -468,11 +468,11 @@ export function setGamepadDeadzone(value) {
468
468
  * @memberOf me.input
469
469
  * @public
470
470
  * @function
471
- * @param {String} id Gamepad id string
472
- * @param {Object} mapping A hash table
473
- * @param {Number[]} mapping.axes Standard analog control stick axis locations
474
- * @param {Number[]} mapping.buttons Standard digital button locations
475
- * @param {Number[]} [mapping.analog] Analog axis locations for buttons
471
+ * @param {string} id Gamepad id string
472
+ * @param {object} mapping A hash table
473
+ * @param {number[]} mapping.axes Standard analog control stick axis locations
474
+ * @param {number[]} mapping.buttons Standard digital button locations
475
+ * @param {number[]} [mapping.analog] Analog axis locations for buttons
476
476
  * @param {Function} [mapping.normalize_fn] a function that returns a normalized value in range [-1.0..1.0] for the given value, axis and button
477
477
  * @example
478
478
  * // A weird controller that has its axis mappings reversed
@@ -6,7 +6,7 @@
6
6
  /**
7
7
  * specify if melonJS should prevent all default browser action on registered events.
8
8
  * @public
9
- * @type Boolean
9
+ * @type {boolean}
10
10
  * @default true
11
11
  * @name preventDefault
12
12
  * @memberOf me.input
@@ -98,7 +98,7 @@ var keyUpEvent = function (e, keyCode, mouseButton) {
98
98
  /**
99
99
  * the default target element for keyboard events (usually the window element in which the game is running)
100
100
  * @public
101
- * @type EventTarget
101
+ * @type {EventTarget}
102
102
  * @name keyBoardEventTarget
103
103
  * @memberOf me.input
104
104
  */
@@ -331,18 +331,15 @@ export function initKeyboardEvent() {
331
331
  * @memberOf me.input
332
332
  * @public
333
333
  * @function
334
- * @param {String} action user defined corresponding action
335
- * @return {Boolean} true if pressed
334
+ * @param {string} action user defined corresponding action
335
+ * @returns {boolean} true if pressed
336
336
  * @example
337
- * if (me.input.isKeyPressed('left'))
338
- * {
337
+ * if (me.input.isKeyPressed('left')) {
339
338
  * //do something
340
339
  * }
341
- * else if (me.input.isKeyPressed('right'))
342
- * {
340
+ * else if (me.input.isKeyPressed('right')) {
343
341
  * //do something else...
344
342
  * }
345
- *
346
343
  */
347
344
  export function isKeyPressed(action) {
348
345
  if (_keyStatus[action] && !_keyLocked[action]) {
@@ -360,8 +357,8 @@ export function isKeyPressed(action) {
360
357
  * @memberOf me.input
361
358
  * @public
362
359
  * @function
363
- * @param {String} action user defined corresponding action
364
- * @return {Boolean} down (true) or up(false)
360
+ * @param {string} action user defined corresponding action
361
+ * @returns {boolean} down (true) or up(false)
365
362
  */
366
363
  export function keyStatus(action) {
367
364
  return (_keyStatus[action] > 0);
@@ -375,7 +372,8 @@ export function keyStatus(action) {
375
372
  * @public
376
373
  * @function
377
374
  * @param {me.input.KEY} keycode
378
- * @param {Boolean} [status=false] true to trigger a key down event, or false for key up event
375
+ * @param {boolean} [status=false] true to trigger a key down event, or false for key up event
376
+ * @param {number} [mouseButton] the mouse button to trigger
379
377
  * @example
380
378
  * // trigger a key press
381
379
  * me.input.triggerKeyEvent(me.input.KEY.LEFT, true);
@@ -397,9 +395,9 @@ export function triggerKeyEvent(keycode, status, mouseButton) {
397
395
  * @public
398
396
  * @function
399
397
  * @param {me.input.KEY} keycode
400
- * @param {String} action user defined corresponding action
401
- * @param {Boolean} [lock=false] cancel the keypress event once read
402
- * @param {Boolean} [preventDefault=me.input.preventDefault] prevent default browser action
398
+ * @param {string} action user defined corresponding action
399
+ * @param {boolean} [lock=false] cancel the keypress event once read
400
+ * @param {boolean} [preventDefault=me.input.preventDefault] prevent default browser action
403
401
  * @example
404
402
  * // enable the keyboard
405
403
  * me.input.bindKey(me.input.KEY.LEFT, "left");
@@ -424,7 +422,7 @@ export function bindKey(keycode, action, lock, preventDefault = preventDefaultAc
424
422
  * @public
425
423
  * @function
426
424
  * @param {me.input.KEY} keycode
427
- * @return {String} user defined associated action
425
+ * @returns {string} user defined associated action
428
426
  */
429
427
  export function getBindingKey(keycode) {
430
428
  return _keyBindings[keycode];
@@ -436,7 +434,7 @@ export function getBindingKey(keycode) {
436
434
  * @memberOf me.input
437
435
  * @public
438
436
  * @function
439
- * @param {String} action user defined corresponding action
437
+ * @param {string} action user defined corresponding action
440
438
  * @example
441
439
  * // Unlock jump when touching the ground
442
440
  * if (!this.falling && !this.jumping) {
@@ -14,7 +14,7 @@ var tmpVec = new Vector2d();
14
14
  /**
15
15
  * @classdesc
16
16
  * a pointer object, representing a single finger on a touch enabled device.
17
- * @class
17
+ * @class Pointer
18
18
  * @extends me.Bounds
19
19
  * @memberOf me
20
20
  * @constructor
@@ -35,7 +35,7 @@ class Pointer extends Bounds {
35
35
  /**
36
36
  * constant for left button
37
37
  * @public
38
- * @type {Number}
38
+ * @type {number}
39
39
  * @name LEFT
40
40
  * @memberOf me.Pointer
41
41
  */
@@ -44,7 +44,7 @@ class Pointer extends Bounds {
44
44
  /**
45
45
  * constant for middle button
46
46
  * @public
47
- * @type {Number}
47
+ * @type {number}
48
48
  * @name MIDDLE
49
49
  * @memberOf me.Pointer
50
50
  */
@@ -53,7 +53,7 @@ class Pointer extends Bounds {
53
53
  /**
54
54
  * constant for right button
55
55
  * @public
56
- * @type {Number}
56
+ * @type {number}
57
57
  * @name RIGHT
58
58
  * @memberOf me.Pointer
59
59
  */
@@ -74,7 +74,7 @@ class Pointer extends Bounds {
74
74
  /**
75
75
  * a string containing the event's type.
76
76
  * @public
77
- * @type {String}
77
+ * @type {string}
78
78
  * @name type
79
79
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Event/type
80
80
  * @memberOf me.Pointer
@@ -85,7 +85,7 @@ class Pointer extends Bounds {
85
85
  /**
86
86
  * the button property indicates which button was pressed on the mouse to trigger the event.
87
87
  * @public
88
- * @type {Number}
88
+ * @type {number}
89
89
  * @name button
90
90
  * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button
91
91
  * @memberOf me.Pointer
@@ -95,7 +95,7 @@ class Pointer extends Bounds {
95
95
  /**
96
96
  * indicates whether or not the pointer device that created the event is the primary pointer.
97
97
  * @public
98
- * @type {Boolean}
98
+ * @type {boolean}
99
99
  * @name isPrimary
100
100
  * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/isPrimary
101
101
  * @memberOf me.Pointer
@@ -105,7 +105,7 @@ class Pointer extends Bounds {
105
105
  /**
106
106
  * the horizontal coordinate at which the event occurred, relative to the left edge of the entire document.
107
107
  * @public
108
- * @type {Number}
108
+ * @type {number}
109
109
  * @name pageX
110
110
  * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/pageX
111
111
  * @memberOf me.Pointer
@@ -115,7 +115,7 @@ class Pointer extends Bounds {
115
115
  /**
116
116
  * the vertical coordinate at which the event occurred, relative to the left edge of the entire document.
117
117
  * @public
118
- * @type {Number}
118
+ * @type {number}
119
119
  * @name pageY
120
120
  * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/pageY
121
121
  * @memberOf me.Pointer
@@ -125,7 +125,7 @@ class Pointer extends Bounds {
125
125
  /**
126
126
  * the horizontal coordinate within the application's client area at which the event occurred
127
127
  * @public
128
- * @type {Number}
128
+ * @type {number}
129
129
  * @name clientX
130
130
  * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/clientX
131
131
  * @memberOf me.Pointer
@@ -135,7 +135,7 @@ class Pointer extends Bounds {
135
135
  /**
136
136
  * the vertical coordinate within the application's client area at which the event occurred
137
137
  * @public
138
- * @type {Number}
138
+ * @type {number}
139
139
  * @name clientY
140
140
  * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/clientY
141
141
  * @memberOf me.Pointer
@@ -145,7 +145,7 @@ class Pointer extends Bounds {
145
145
  /**
146
146
  * an unsigned long representing the unit of the delta values scroll amount
147
147
  * @public
148
- * @type {Number}
148
+ * @type {number}
149
149
  * @name deltaMode
150
150
  * @see https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent/deltaMode
151
151
  * @memberOf me.Pointer
@@ -155,7 +155,7 @@ class Pointer extends Bounds {
155
155
  /**
156
156
  * a double representing the horizontal scroll amount in the Wheel Event deltaMode unit.
157
157
  * @public
158
- * @type {Number}
158
+ * @type {number}
159
159
  * @name deltaX
160
160
  * @see https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent/deltaX
161
161
  * @memberOf me.Pointer
@@ -165,7 +165,7 @@ class Pointer extends Bounds {
165
165
  /**
166
166
  * a double representing the vertical scroll amount in the Wheel Event deltaMode unit.
167
167
  * @public
168
- * @type {Number}
168
+ * @type {number}
169
169
  * @name deltaY
170
170
  * @see https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent/deltaY
171
171
  * @memberOf me.Pointer
@@ -175,7 +175,7 @@ class Pointer extends Bounds {
175
175
  /**
176
176
  * a double representing the scroll amount in the z-axis, in the Wheel Event deltaMode unit.
177
177
  * @public
178
- * @type {Number}
178
+ * @type {number}
179
179
  * @name deltaZ
180
180
  * @see https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent/deltaZ
181
181
  * @memberOf me.Pointer
@@ -186,7 +186,7 @@ class Pointer extends Bounds {
186
186
  * Event normalized X coordinate within the game canvas itself<br>
187
187
  * <img src="images/event_coord.png"/>
188
188
  * @public
189
- * @type {Number}
189
+ * @type {number}
190
190
  * @name gameX
191
191
  * @memberOf me.Pointer
192
192
  */
@@ -196,7 +196,7 @@ class Pointer extends Bounds {
196
196
  * Event normalized Y coordinate within the game canvas itself<br>
197
197
  * <img src="images/event_coord.png"/>
198
198
  * @public
199
- * @type {Number}
199
+ * @type {number}
200
200
  * @name gameY
201
201
  * @memberOf me.Pointer
202
202
  */
@@ -205,7 +205,7 @@ class Pointer extends Bounds {
205
205
  /**
206
206
  * Event X coordinate relative to the viewport
207
207
  * @public
208
- * @type {Number}
208
+ * @type {number}
209
209
  * @name gameScreenX
210
210
  * @memberOf me.Pointer
211
211
  */
@@ -214,7 +214,7 @@ class Pointer extends Bounds {
214
214
  /**
215
215
  * Event Y coordinate relative to the viewport
216
216
  * @public
217
- * @type {Number}
217
+ * @type {number}
218
218
  * @name gameScreenY
219
219
  * @memberOf me.Pointer
220
220
  */
@@ -223,7 +223,7 @@ class Pointer extends Bounds {
223
223
  /**
224
224
  * Event X coordinate relative to the map
225
225
  * @public
226
- * @type {Number}
226
+ * @type {number}
227
227
  * @name gameWorldX
228
228
  * @memberOf me.Pointer
229
229
  */
@@ -232,7 +232,7 @@ class Pointer extends Bounds {
232
232
  /**
233
233
  * Event Y coordinate relative to the map
234
234
  * @public
235
- * @type {Number}
235
+ * @type {number}
236
236
  * @name gameWorldY
237
237
  * @memberOf me.Pointer
238
238
  */
@@ -241,7 +241,7 @@ class Pointer extends Bounds {
241
241
  /**
242
242
  * Event X coordinate relative to the holding container
243
243
  * @public
244
- * @type {Number}
244
+ * @type {number}
245
245
  * @name gameLocalX
246
246
  * @memberOf me.Pointer
247
247
  */
@@ -250,21 +250,30 @@ class Pointer extends Bounds {
250
250
  /**
251
251
  * Event Y coordinate relative to the holding container
252
252
  * @public
253
- * @type {Number}
253
+ * @type {number}
254
254
  * @name gameLocalY
255
255
  * @memberOf me.Pointer
256
256
  */
257
257
  this.gameLocalY = 0;
258
258
 
259
259
  /**
260
- * The unique identifier of the contact for a touch, mouse or pen
260
+ * The unique identifier of the contact for a touch, mouse or pen
261
+ * @public
262
+ * @type {number}
263
+ * @name pointerId
264
+ * @memberOf me.Pointer
265
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerId
266
+ */
267
+ this.pointerId = undefined;
268
+
269
+ /**
270
+ * true if not originally a pointer event
261
271
  * @public
262
- * @type {Number}
263
- * @name pointerId
272
+ * @type {boolean}
273
+ * @name isNormalized
264
274
  * @memberOf me.Pointer
265
- * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerId
266
275
  */
267
- this.pointerId = undefined;
276
+ this.isNormalized = false;
268
277
 
269
278
  // bind list for mouse buttons
270
279
  this.bind = [ 0, 0, 0 ];
@@ -276,11 +285,11 @@ class Pointer extends Bounds {
276
285
  * @private
277
286
  * @function
278
287
  * @param {Event} event the original Event object
279
- * @param {Number} [pageX=0] the horizontal coordinate at which the event occurred, relative to the left edge of the entire document
280
- * @param {Number} [pageY=0] the vertical coordinate at which the event occurred, relative to the left edge of the entire document
281
- * @param {Number} [clientX=0] the horizontal coordinate within the application's client area at which the event occurred
282
- * @param {Number} [clientX=0] the vertical coordinate within the application's client area at which the event occurred
283
- * @param {Number} [pointedId=1] the Pointer, Touch or Mouse event Id (1)
288
+ * @param {number} [pageX=0] the horizontal coordinate at which the event occurred, relative to the left edge of the entire document
289
+ * @param {number} [pageY=0] the vertical coordinate at which the event occurred, relative to the left edge of the entire document
290
+ * @param {number} [clientX=0] the horizontal coordinate within the application's client area at which the event occurred
291
+ * @param {number} [clientY=0] the vertical coordinate within the application's client area at which the event occurred
292
+ * @param {number} [pointerId=1] the Pointer, Touch or Mouse event Id (1)
284
293
  */
285
294
  setEvent(event, pageX = 0, pageY = 0, clientX = 0, clientY = 0, pointerId = 1) {
286
295
  // the original event object
@@ -320,8 +329,6 @@ class Pointer extends Bounds {
320
329
 
321
330
  this.type = event.type;
322
331
 
323
-
324
-
325
332
  // get the current screen to game world offset
326
333
  if (typeof viewport !== "undefined") {
327
334
  viewport.localToWorld(this.gameScreenX, this.gameScreenY, tmpVec);