@vpmedia/phaser 1.15.0 → 1.17.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 (290) hide show
  1. package/README.md +3 -3
  2. package/package.json +6 -5
  3. package/src/index.js +15 -18
  4. package/src/phaser/core/animation.js +114 -6
  5. package/src/phaser/core/animation_manager.js +102 -10
  6. package/src/phaser/core/animation_parser.js +6 -19
  7. package/src/phaser/core/array_set.js +59 -5
  8. package/src/phaser/core/cache.js +307 -6
  9. package/src/phaser/core/const.js +107 -4
  10. package/src/phaser/core/device.js +3 -6
  11. package/src/phaser/core/device_util.js +3 -16
  12. package/src/phaser/core/dom.js +127 -29
  13. package/src/phaser/core/event_manager.js +128 -6
  14. package/src/phaser/core/factory.js +69 -34
  15. package/src/phaser/core/frame.js +43 -6
  16. package/src/phaser/core/frame_data.js +55 -5
  17. package/src/phaser/core/frame_util.js +7 -12
  18. package/src/phaser/core/game.js +35 -7
  19. package/src/phaser/core/input.js +133 -17
  20. package/src/phaser/core/input_handler.js +243 -43
  21. package/src/phaser/core/input_mouse.js +70 -5
  22. package/src/phaser/core/input_mspointer.js +40 -9
  23. package/src/phaser/core/input_pointer.js +88 -17
  24. package/src/phaser/core/input_touch.js +42 -5
  25. package/src/phaser/core/loader.js +303 -101
  26. package/src/phaser/core/loader_parser.js +2 -10
  27. package/src/phaser/core/raf.js +16 -5
  28. package/src/phaser/core/scale_manager.js +204 -39
  29. package/src/phaser/core/scene.js +24 -5
  30. package/src/phaser/core/scene_manager.js +81 -11
  31. package/src/phaser/core/signal.js +88 -11
  32. package/src/phaser/core/signal_binding.js +35 -15
  33. package/src/phaser/core/sound.js +99 -10
  34. package/src/phaser/core/sound_manager.js +89 -13
  35. package/src/phaser/core/sound_sprite.js +20 -5
  36. package/src/phaser/core/stage.js +43 -7
  37. package/src/phaser/core/time.js +67 -5
  38. package/src/phaser/core/timer.js +107 -30
  39. package/src/phaser/core/timer_event.js +11 -6
  40. package/src/phaser/core/tween.js +124 -30
  41. package/src/phaser/core/tween_data.js +42 -18
  42. package/src/phaser/core/tween_easing.js +1 -8
  43. package/src/phaser/core/tween_manager.js +47 -5
  44. package/src/phaser/core/world.js +9 -6
  45. package/src/phaser/display/bitmap_text.js +91 -10
  46. package/src/phaser/display/button.js +63 -12
  47. package/src/phaser/display/canvas/buffer.js +16 -6
  48. package/src/phaser/display/canvas/graphics.js +1 -13
  49. package/src/phaser/display/canvas/masker.js +0 -6
  50. package/src/phaser/display/canvas/pool.js +0 -7
  51. package/src/phaser/display/canvas/renderer.js +28 -8
  52. package/src/phaser/display/canvas/tinter.js +4 -43
  53. package/src/phaser/display/canvas/util.js +0 -6
  54. package/src/phaser/display/display_object.js +192 -20
  55. package/src/phaser/display/graphics.js +161 -26
  56. package/src/phaser/display/graphics_data.js +14 -6
  57. package/src/phaser/display/graphics_data_util.js +2 -8
  58. package/src/phaser/display/group.js +82 -9
  59. package/src/phaser/display/image.js +87 -9
  60. package/src/phaser/display/sprite_batch.js +3 -8
  61. package/src/phaser/display/sprite_util.js +3 -23
  62. package/src/phaser/display/text.js +331 -31
  63. package/src/phaser/display/webgl/abstract_filter.js +8 -7
  64. package/src/phaser/display/webgl/base_texture.js +20 -12
  65. package/src/phaser/display/webgl/blend_manager.js +14 -7
  66. package/src/phaser/display/webgl/earcut.js +4 -23
  67. package/src/phaser/display/webgl/earcut_node.js +6 -7
  68. package/src/phaser/display/webgl/fast_sprite_batch.js +34 -11
  69. package/src/phaser/display/webgl/filter_manager.js +25 -7
  70. package/src/phaser/display/webgl/filter_texture.js +21 -22
  71. package/src/phaser/display/webgl/graphics.js +5 -28
  72. package/src/phaser/display/webgl/graphics_data.js +10 -7
  73. package/src/phaser/display/webgl/mask_manager.js +0 -6
  74. package/src/phaser/display/webgl/render_texture.js +33 -21
  75. package/src/phaser/display/webgl/renderer.js +38 -11
  76. package/src/phaser/display/webgl/shader/complex.js +10 -6
  77. package/src/phaser/display/webgl/shader/fast.js +10 -6
  78. package/src/phaser/display/webgl/shader/normal.js +23 -32
  79. package/src/phaser/display/webgl/shader/primitive.js +10 -6
  80. package/src/phaser/display/webgl/shader/strip.js +10 -6
  81. package/src/phaser/display/webgl/shader_manager.js +18 -6
  82. package/src/phaser/display/webgl/sprite_batch.js +41 -8
  83. package/src/phaser/display/webgl/stencil_manager.js +28 -6
  84. package/src/phaser/display/webgl/texture.js +28 -15
  85. package/src/phaser/display/webgl/texture_util.js +0 -6
  86. package/src/phaser/display/webgl/util.js +0 -7
  87. package/src/phaser/geom/circle.js +123 -18
  88. package/src/phaser/geom/ellipse.js +39 -18
  89. package/src/phaser/geom/line.js +148 -16
  90. package/src/phaser/geom/matrix.js +73 -6
  91. package/src/phaser/geom/point.js +152 -6
  92. package/src/phaser/geom/polygon.js +42 -14
  93. package/src/phaser/geom/rectangle.js +233 -6
  94. package/src/phaser/geom/rounded_rectangle.js +10 -6
  95. package/src/phaser/geom/util/circle.js +3 -9
  96. package/src/phaser/geom/util/ellipse.js +0 -7
  97. package/src/phaser/geom/util/line.js +5 -14
  98. package/src/phaser/geom/util/matrix.js +1 -7
  99. package/src/phaser/geom/util/point.js +0 -6
  100. package/src/phaser/geom/util/polygon.js +1 -7
  101. package/src/phaser/geom/util/rectangle.js +1 -7
  102. package/src/phaser/geom/util/rounded_rectangle.js +1 -7
  103. package/src/phaser/util/math.js +3 -21
  104. package/types/index.d.ts +2 -1
  105. package/types/index.d.ts.map +1 -1
  106. package/types/phaser/core/animation.d.ts +126 -13
  107. package/types/phaser/core/animation.d.ts.map +1 -1
  108. package/types/phaser/core/animation_manager.d.ts +121 -19
  109. package/types/phaser/core/animation_manager.d.ts.map +1 -1
  110. package/types/phaser/core/animation_parser.d.ts +6 -5
  111. package/types/phaser/core/animation_parser.d.ts.map +1 -1
  112. package/types/phaser/core/array_set.d.ts +67 -13
  113. package/types/phaser/core/array_set.d.ts.map +1 -1
  114. package/types/phaser/core/cache.d.ts +365 -69
  115. package/types/phaser/core/cache.d.ts.map +1 -1
  116. package/types/phaser/core/const.d.ts +143 -40
  117. package/types/phaser/core/const.d.ts.map +1 -1
  118. package/types/phaser/core/device.d.ts +0 -5
  119. package/types/phaser/core/device.d.ts.map +1 -1
  120. package/types/phaser/core/device_util.d.ts +1 -1
  121. package/types/phaser/core/device_util.d.ts.map +1 -1
  122. package/types/phaser/core/dom.d.ts +119 -0
  123. package/types/phaser/core/dom.d.ts.map +1 -1
  124. package/types/phaser/core/event_manager.d.ts +127 -0
  125. package/types/phaser/core/event_manager.d.ts.map +1 -1
  126. package/types/phaser/core/factory.d.ts +75 -8
  127. package/types/phaser/core/factory.d.ts.map +1 -1
  128. package/types/phaser/core/frame.d.ts +64 -21
  129. package/types/phaser/core/frame.d.ts.map +1 -1
  130. package/types/phaser/core/frame_data.d.ts +61 -9
  131. package/types/phaser/core/frame_data.d.ts.map +1 -1
  132. package/types/phaser/core/frame_util.d.ts +10 -8
  133. package/types/phaser/core/frame_util.d.ts.map +1 -1
  134. package/types/phaser/core/game.d.ts +40 -6
  135. package/types/phaser/core/game.d.ts.map +1 -1
  136. package/types/phaser/core/input.d.ts +143 -15
  137. package/types/phaser/core/input.d.ts.map +1 -1
  138. package/types/phaser/core/input_handler.d.ts +258 -25
  139. package/types/phaser/core/input_handler.d.ts.map +1 -1
  140. package/types/phaser/core/input_mouse.d.ts +62 -14
  141. package/types/phaser/core/input_mouse.d.ts.map +1 -1
  142. package/types/phaser/core/input_mspointer.d.ts +51 -17
  143. package/types/phaser/core/input_mspointer.d.ts.map +1 -1
  144. package/types/phaser/core/input_pointer.d.ts +99 -14
  145. package/types/phaser/core/input_pointer.d.ts.map +1 -1
  146. package/types/phaser/core/input_touch.d.ts +53 -16
  147. package/types/phaser/core/input_touch.d.ts.map +1 -1
  148. package/types/phaser/core/loader.d.ts +299 -28
  149. package/types/phaser/core/loader.d.ts.map +1 -1
  150. package/types/phaser/core/loader_parser.d.ts.map +1 -1
  151. package/types/phaser/core/raf.d.ts +19 -9
  152. package/types/phaser/core/raf.d.ts.map +1 -1
  153. package/types/phaser/core/scale_manager.d.ts +208 -13
  154. package/types/phaser/core/scale_manager.d.ts.map +1 -1
  155. package/types/phaser/core/scene.d.ts +21 -5
  156. package/types/phaser/core/scene.d.ts.map +1 -1
  157. package/types/phaser/core/scene_manager.d.ts +90 -10
  158. package/types/phaser/core/scene_manager.d.ts.map +1 -1
  159. package/types/phaser/core/signal.d.ts +93 -9
  160. package/types/phaser/core/signal.d.ts.map +1 -1
  161. package/types/phaser/core/signal_binding.d.ts +34 -5
  162. package/types/phaser/core/signal_binding.d.ts.map +1 -1
  163. package/types/phaser/core/sound.d.ts +111 -14
  164. package/types/phaser/core/sound.d.ts.map +1 -1
  165. package/types/phaser/core/sound_manager.d.ts +97 -11
  166. package/types/phaser/core/sound_manager.d.ts.map +1 -1
  167. package/types/phaser/core/sound_sprite.d.ts +22 -8
  168. package/types/phaser/core/sound_sprite.d.ts.map +1 -1
  169. package/types/phaser/core/stage.d.ts +32 -3
  170. package/types/phaser/core/stage.d.ts.map +1 -1
  171. package/types/phaser/core/time.d.ts +73 -6
  172. package/types/phaser/core/time.d.ts.map +1 -1
  173. package/types/phaser/core/timer.d.ts +108 -7
  174. package/types/phaser/core/timer.d.ts.map +1 -1
  175. package/types/phaser/core/timer_event.d.ts +13 -7
  176. package/types/phaser/core/timer_event.d.ts.map +1 -1
  177. package/types/phaser/core/tween.d.ts +124 -4
  178. package/types/phaser/core/tween.d.ts.map +1 -1
  179. package/types/phaser/core/tween_data.d.ts +41 -2
  180. package/types/phaser/core/tween_data.d.ts.map +1 -1
  181. package/types/phaser/core/tween_easing.d.ts +0 -5
  182. package/types/phaser/core/tween_easing.d.ts.map +1 -1
  183. package/types/phaser/core/tween_manager.d.ts +49 -2
  184. package/types/phaser/core/tween_manager.d.ts.map +1 -1
  185. package/types/phaser/core/world.d.ts +9 -1
  186. package/types/phaser/core/world.d.ts.map +1 -1
  187. package/types/phaser/display/bitmap_text.d.ts +84 -7
  188. package/types/phaser/display/bitmap_text.d.ts.map +1 -1
  189. package/types/phaser/display/button.d.ts +65 -8
  190. package/types/phaser/display/button.d.ts.map +1 -1
  191. package/types/phaser/display/canvas/buffer.d.ts +20 -4
  192. package/types/phaser/display/canvas/buffer.d.ts.map +1 -1
  193. package/types/phaser/display/canvas/graphics.d.ts.map +1 -1
  194. package/types/phaser/display/canvas/masker.d.ts.map +1 -1
  195. package/types/phaser/display/canvas/pool.d.ts +0 -6
  196. package/types/phaser/display/canvas/pool.d.ts.map +1 -1
  197. package/types/phaser/display/canvas/renderer.d.ts +29 -2
  198. package/types/phaser/display/canvas/renderer.d.ts.map +1 -1
  199. package/types/phaser/display/canvas/tinter.d.ts.map +1 -1
  200. package/types/phaser/display/canvas/util.d.ts.map +1 -1
  201. package/types/phaser/display/display_object.d.ts +195 -8
  202. package/types/phaser/display/display_object.d.ts.map +1 -1
  203. package/types/phaser/display/graphics.d.ts +132 -6
  204. package/types/phaser/display/graphics.d.ts.map +1 -1
  205. package/types/phaser/display/graphics_data.d.ts +15 -1
  206. package/types/phaser/display/graphics_data.d.ts.map +1 -1
  207. package/types/phaser/display/graphics_data_util.d.ts +3 -2
  208. package/types/phaser/display/graphics_data_util.d.ts.map +1 -1
  209. package/types/phaser/display/group.d.ts +80 -10
  210. package/types/phaser/display/group.d.ts.map +1 -1
  211. package/types/phaser/display/image.d.ts +72 -6
  212. package/types/phaser/display/image.d.ts.map +1 -1
  213. package/types/phaser/display/sprite_batch.d.ts +4 -3
  214. package/types/phaser/display/sprite_batch.d.ts.map +1 -1
  215. package/types/phaser/display/sprite_util.d.ts.map +1 -1
  216. package/types/phaser/display/text.d.ts +366 -46
  217. package/types/phaser/display/text.d.ts.map +1 -1
  218. package/types/phaser/display/webgl/abstract_filter.d.ts +8 -6
  219. package/types/phaser/display/webgl/abstract_filter.d.ts.map +1 -1
  220. package/types/phaser/display/webgl/base_texture.d.ts +20 -1
  221. package/types/phaser/display/webgl/base_texture.d.ts.map +1 -1
  222. package/types/phaser/display/webgl/blend_manager.d.ts +11 -6
  223. package/types/phaser/display/webgl/blend_manager.d.ts.map +1 -1
  224. package/types/phaser/display/webgl/earcut.d.ts.map +1 -1
  225. package/types/phaser/display/webgl/earcut_node.d.ts +9 -9
  226. package/types/phaser/display/webgl/earcut_node.d.ts.map +1 -1
  227. package/types/phaser/display/webgl/fast_sprite_batch.d.ts +33 -6
  228. package/types/phaser/display/webgl/fast_sprite_batch.d.ts.map +1 -1
  229. package/types/phaser/display/webgl/filter_manager.d.ts +22 -6
  230. package/types/phaser/display/webgl/filter_manager.d.ts.map +1 -1
  231. package/types/phaser/display/webgl/filter_texture.d.ts +21 -3
  232. package/types/phaser/display/webgl/filter_texture.d.ts.map +1 -1
  233. package/types/phaser/display/webgl/graphics.d.ts.map +1 -1
  234. package/types/phaser/display/webgl/graphics_data.d.ts +10 -6
  235. package/types/phaser/display/webgl/graphics_data.d.ts.map +1 -1
  236. package/types/phaser/display/webgl/mask_manager.d.ts.map +1 -1
  237. package/types/phaser/display/webgl/render_texture.d.ts +30 -3
  238. package/types/phaser/display/webgl/render_texture.d.ts.map +1 -1
  239. package/types/phaser/display/webgl/renderer.d.ts +41 -4
  240. package/types/phaser/display/webgl/renderer.d.ts.map +1 -1
  241. package/types/phaser/display/webgl/shader/complex.d.ts +10 -0
  242. package/types/phaser/display/webgl/shader/complex.d.ts.map +1 -1
  243. package/types/phaser/display/webgl/shader/fast.d.ts +10 -0
  244. package/types/phaser/display/webgl/shader/fast.d.ts.map +1 -1
  245. package/types/phaser/display/webgl/shader/normal.d.ts +20 -0
  246. package/types/phaser/display/webgl/shader/normal.d.ts.map +1 -1
  247. package/types/phaser/display/webgl/shader/primitive.d.ts +10 -0
  248. package/types/phaser/display/webgl/shader/primitive.d.ts.map +1 -1
  249. package/types/phaser/display/webgl/shader/strip.d.ts +10 -0
  250. package/types/phaser/display/webgl/shader/strip.d.ts.map +1 -1
  251. package/types/phaser/display/webgl/shader_manager.d.ts +15 -0
  252. package/types/phaser/display/webgl/shader_manager.d.ts.map +1 -1
  253. package/types/phaser/display/webgl/sprite_batch.d.ts +37 -0
  254. package/types/phaser/display/webgl/sprite_batch.d.ts.map +1 -1
  255. package/types/phaser/display/webgl/stencil_manager.d.ts +25 -0
  256. package/types/phaser/display/webgl/stencil_manager.d.ts.map +1 -1
  257. package/types/phaser/display/webgl/texture.d.ts +21 -0
  258. package/types/phaser/display/webgl/texture.d.ts.map +1 -1
  259. package/types/phaser/display/webgl/texture_util.d.ts.map +1 -1
  260. package/types/phaser/display/webgl/util.d.ts +0 -6
  261. package/types/phaser/display/webgl/util.d.ts.map +1 -1
  262. package/types/phaser/geom/circle.d.ts +131 -9
  263. package/types/phaser/geom/circle.d.ts.map +1 -1
  264. package/types/phaser/geom/ellipse.d.ts +43 -5
  265. package/types/phaser/geom/ellipse.d.ts.map +1 -1
  266. package/types/phaser/geom/line.d.ts +159 -13
  267. package/types/phaser/geom/line.d.ts.map +1 -1
  268. package/types/phaser/geom/matrix.d.ts +85 -11
  269. package/types/phaser/geom/matrix.d.ts.map +1 -1
  270. package/types/phaser/geom/point.d.ts +170 -18
  271. package/types/phaser/geom/point.d.ts.map +1 -1
  272. package/types/phaser/geom/polygon.d.ts +45 -5
  273. package/types/phaser/geom/polygon.d.ts.map +1 -1
  274. package/types/phaser/geom/rectangle.d.ts +253 -20
  275. package/types/phaser/geom/rectangle.d.ts.map +1 -1
  276. package/types/phaser/geom/rounded_rectangle.d.ts +11 -1
  277. package/types/phaser/geom/rounded_rectangle.d.ts.map +1 -1
  278. package/types/phaser/geom/util/circle.d.ts +3 -3
  279. package/types/phaser/geom/util/circle.d.ts.map +1 -1
  280. package/types/phaser/geom/util/ellipse.d.ts +0 -6
  281. package/types/phaser/geom/util/ellipse.d.ts.map +1 -1
  282. package/types/phaser/geom/util/line.d.ts +5 -5
  283. package/types/phaser/geom/util/line.d.ts.map +1 -1
  284. package/types/phaser/geom/util/matrix.d.ts.map +1 -1
  285. package/types/phaser/geom/util/point.d.ts.map +1 -1
  286. package/types/phaser/geom/util/polygon.d.ts.map +1 -1
  287. package/types/phaser/geom/util/rectangle.d.ts.map +1 -1
  288. package/types/phaser/geom/util/rounded_rectangle.d.ts.map +1 -1
  289. package/types/phaser/util/math.d.ts +0 -5
  290. package/types/phaser/util/math.d.ts.map +1 -1
@@ -1,9 +1,3 @@
1
- /**
2
- * @module geom/rectangle
3
- * @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
4
- * @author Andras Csizmadia <andras@vpmedia.hu>
5
- * @author Richard Davey <rich@photonstorm.com>
6
- */
7
1
  import { Point } from './point';
8
2
  import {
9
3
  inflate,
@@ -46,16 +40,35 @@ export class Rectangle {
46
40
  this.type = GEOM_RECTANGLE;
47
41
  }
48
42
 
43
+ /**
44
+ * TBD.
45
+ * @param {number} dx - TBD.
46
+ * @param {number} dy - TBD.
47
+ * @returns {Rectangle} TBD.
48
+ */
49
49
  offset(dx, dy) {
50
50
  this.x += dx;
51
51
  this.y += dy;
52
52
  return this;
53
53
  }
54
54
 
55
+ /**
56
+ * TBD.
57
+ * @param {Point} point - TBD.
58
+ * @returns {Rectangle} TBD.
59
+ */
55
60
  offsetPoint(point) {
56
61
  return this.offset(point.x, point.y);
57
62
  }
58
63
 
64
+ /**
65
+ * TBD.
66
+ * @param {number} x - TBD.
67
+ * @param {number} y - TBD.
68
+ * @param {number} width - TBD.
69
+ * @param {number} height - TBD.
70
+ * @returns {Rectangle} TBD.
71
+ */
59
72
  setTo(x, y, width, height) {
60
73
  this.x = x;
61
74
  this.y = y;
@@ -64,6 +77,12 @@ export class Rectangle {
64
77
  return this;
65
78
  }
66
79
 
80
+ /**
81
+ * TBD.
82
+ * @param {number} x - TBD.
83
+ * @param {number} y - TBD.
84
+ * @returns {Rectangle} TBD.
85
+ */
67
86
  scale(x, y) {
68
87
  if (y === undefined) {
69
88
  y = x;
@@ -73,17 +92,29 @@ export class Rectangle {
73
92
  return this;
74
93
  }
75
94
 
95
+ /**
96
+ * TBD.
97
+ * @param {number} x - TBD.
98
+ * @param {number} y - TBD.
99
+ * @returns {Rectangle} TBD.
100
+ */
76
101
  centerOn(x, y) {
77
102
  this.centerX = x;
78
103
  this.centerY = y;
79
104
  return this;
80
105
  }
81
106
 
107
+ /**
108
+ * TBD.
109
+ */
82
110
  floor() {
83
111
  this.x = Math.floor(this.x);
84
112
  this.y = Math.floor(this.y);
85
113
  }
86
114
 
115
+ /**
116
+ * TBD.
117
+ */
87
118
  floorAll() {
88
119
  this.x = Math.floor(this.x);
89
120
  this.y = Math.floor(this.y);
@@ -91,11 +122,17 @@ export class Rectangle {
91
122
  this.height = Math.floor(this.height);
92
123
  }
93
124
 
125
+ /**
126
+ * TBD.
127
+ */
94
128
  ceil() {
95
129
  this.x = Math.ceil(this.x);
96
130
  this.y = Math.ceil(this.y);
97
131
  }
98
132
 
133
+ /**
134
+ * TBD.
135
+ */
99
136
  ceilAll() {
100
137
  this.x = Math.ceil(this.x);
101
138
  this.y = Math.ceil(this.y);
@@ -103,10 +140,20 @@ export class Rectangle {
103
140
  this.height = Math.ceil(this.height);
104
141
  }
105
142
 
143
+ /**
144
+ * TBD.
145
+ * @param {Rectangle} source - TBD.
146
+ * @returns {Rectangle} TBD.
147
+ */
106
148
  copyFrom(source) {
107
149
  return this.setTo(source.x, source.y, source.width, source.height);
108
150
  }
109
151
 
152
+ /**
153
+ * TBD.
154
+ * @param {Rectangle} dest - TBD.
155
+ * @returns {Rectangle} TBD.
156
+ */
110
157
  copyTo(dest) {
111
158
  dest.x = this.x;
112
159
  dest.y = this.y;
@@ -115,52 +162,121 @@ export class Rectangle {
115
162
  return dest;
116
163
  }
117
164
 
165
+ /**
166
+ * TBD.
167
+ * @param {number} dx - TBD.
168
+ * @param {number} dy - TBD.
169
+ * @returns {Rectangle} TBD.
170
+ */
118
171
  inflate(dx, dy) {
119
172
  return inflate(this, dx, dy);
120
173
  }
121
174
 
175
+ /**
176
+ * TBD.
177
+ * @param {Point} output - TBD.
178
+ * @returns {Point} TBD.
179
+ */
122
180
  size(output) {
123
181
  return size(this, output);
124
182
  }
125
183
 
184
+ /**
185
+ * TBD.
186
+ * @param {number} width - TBD.
187
+ * @param {number} height - TBD.
188
+ * @returns {Rectangle} TBD.
189
+ */
126
190
  resize(width, height) {
127
191
  this.width = width;
128
192
  this.height = height;
129
193
  return this;
130
194
  }
131
195
 
196
+ /**
197
+ * TBD.
198
+ * @param {Rectangle} output - TBD.
199
+ * @returns {Rectangle} TBD.
200
+ */
132
201
  clone(output) {
133
202
  return clone(this, output);
134
203
  }
135
204
 
205
+ /**
206
+ * TBD.
207
+ * @param {number} x - TBD.
208
+ * @param {number} y - TBD.
209
+ * @returns {boolean} TBD.
210
+ */
136
211
  contains(x, y) {
137
212
  return contains(this, x, y);
138
213
  }
139
214
 
215
+ /**
216
+ * TBD.
217
+ * @param {Rectangle} b - TBD.
218
+ * @returns {boolean} TBD.
219
+ */
140
220
  containsRect(b) {
141
221
  return containsRect(b, this);
142
222
  }
143
223
 
224
+ /**
225
+ * TBD.
226
+ * @param {Rectangle} b - TBD.
227
+ * @returns {boolean} TBD.
228
+ */
144
229
  equals(b) {
145
230
  return equals(this, b);
146
231
  }
147
232
 
233
+ /**
234
+ * TBD.
235
+ * @param {Rectangle} b - TBD.
236
+ * @param {Rectangle} out - TBD.
237
+ * @returns {Rectangle} TBD.
238
+ */
148
239
  intersection(b, out) {
149
240
  return intersection(this, b, out);
150
241
  }
151
242
 
243
+ /**
244
+ * TBD.
245
+ * @param {Rectangle} b - TBD.
246
+ * @returns {boolean} TBD.
247
+ */
152
248
  intersects(b) {
153
249
  return intersects(this, b);
154
250
  }
155
251
 
252
+ /**
253
+ * TBD.
254
+ * @param {number} left - TBD.
255
+ * @param {number} right - TBD.
256
+ * @param {number} top - TBD.
257
+ * @param {number} bottom - TBD.
258
+ * @param {number} tolerance - TBD.
259
+ * @returns {boolean} TBD.
260
+ */
156
261
  intersectsRaw(left, right, top, bottom, tolerance) {
157
262
  return intersectsRaw(this, left, right, top, bottom, tolerance);
158
263
  }
159
264
 
265
+ /**
266
+ * TBD.
267
+ * @param {Rectangle} b - TBD.
268
+ * @param {Rectangle} out - TBD.
269
+ * @returns {Rectangle} TBD.
270
+ */
160
271
  union(b, out) {
161
272
  return union(this, b, out);
162
273
  }
163
274
 
275
+ /**
276
+ * TBD.
277
+ * @param {Point} output - TBD.
278
+ * @returns {Point} TBD.
279
+ */
164
280
  random(output = null) {
165
281
  const result = output || new Point();
166
282
  result.x = this.randomX;
@@ -168,6 +284,12 @@ export class Rectangle {
168
284
  return result;
169
285
  }
170
286
 
287
+ /**
288
+ * TBD.
289
+ * @param {number} position - TBD.
290
+ * @param {Point} output - TBD.
291
+ * @returns {Point} TBD.
292
+ */
171
293
  getPoint(position, output = null) {
172
294
  const result = output || new Point();
173
295
  switch (position) {
@@ -194,6 +316,10 @@ export class Rectangle {
194
316
  }
195
317
  }
196
318
 
319
+ /**
320
+ * TBD.
321
+ * @returns {string} TBD.
322
+ */
197
323
  toString() {
198
324
  return (
199
325
  '[{Rectangle (x=' +
@@ -210,18 +336,33 @@ export class Rectangle {
210
336
  );
211
337
  }
212
338
 
339
+ /**
340
+ * TBD.
341
+ * @returns {number} TBD.
342
+ */
213
343
  get halfWidth() {
214
344
  return Math.round(this.width / 2);
215
345
  }
216
346
 
347
+ /**
348
+ * TBD.
349
+ * @returns {number} TBD.
350
+ */
217
351
  get halfHeight() {
218
352
  return Math.round(this.height / 2);
219
353
  }
220
354
 
355
+ /**
356
+ * TBD.
357
+ * @returns {number} TBD.
358
+ */
221
359
  get top() {
222
360
  return this.y;
223
361
  }
224
362
 
363
+ /**
364
+ * TBD.
365
+ */
225
366
  set top(value) {
226
367
  if (value >= this.bottom) {
227
368
  this.height = 0;
@@ -231,28 +372,49 @@ export class Rectangle {
231
372
  }
232
373
  }
233
374
 
375
+ /**
376
+ * TBD.
377
+ * @returns {Point} TBD.
378
+ */
234
379
  get topLeft() {
235
380
  return new Point(this.x, this.y);
236
381
  }
237
382
 
383
+ /**
384
+ * TBD.
385
+ */
238
386
  set topLeft(value) {
239
387
  this.x = value.x;
240
388
  this.y = value.y;
241
389
  }
242
390
 
391
+ /**
392
+ * TBD.
393
+ * @returns {Point} TBD.
394
+ */
243
395
  get topRight() {
244
396
  return new Point(this.x + this.width, this.y);
245
397
  }
246
398
 
399
+ /**
400
+ * TBD.
401
+ */
247
402
  set topRight(value) {
248
403
  this.right = value.x;
249
404
  this.y = value.y;
250
405
  }
251
406
 
407
+ /**
408
+ * TBD.
409
+ * @returns {number} TBD.
410
+ */
252
411
  get bottom() {
253
412
  return this.y + this.height;
254
413
  }
255
414
 
415
+ /**
416
+ * TBD.
417
+ */
256
418
  set bottom(value) {
257
419
  if (value <= this.y) {
258
420
  this.height = 0;
@@ -261,28 +423,49 @@ export class Rectangle {
261
423
  }
262
424
  }
263
425
 
426
+ /**
427
+ * TBD.
428
+ * @returns {Point} TBD.
429
+ */
264
430
  get bottomLeft() {
265
431
  return new Point(this.x, this.bottom);
266
432
  }
267
433
 
434
+ /**
435
+ * TBD.
436
+ */
268
437
  set bottomLeft(value) {
269
438
  this.x = value.x;
270
439
  this.bottom = value.y;
271
440
  }
272
441
 
442
+ /**
443
+ * TBD.
444
+ * @returns {Point} TBD.
445
+ */
273
446
  get bottomRight() {
274
447
  return new Point(this.right, this.bottom);
275
448
  }
276
449
 
450
+ /**
451
+ * TBD.
452
+ */
277
453
  set bottomRight(value) {
278
454
  this.right = value.x;
279
455
  this.bottom = value.y;
280
456
  }
281
457
 
458
+ /**
459
+ * TBD.
460
+ * @returns {number} TBD.
461
+ */
282
462
  get left() {
283
463
  return this.x;
284
464
  }
285
465
 
466
+ /**
467
+ * TBD.
468
+ */
286
469
  set left(value) {
287
470
  if (value >= this.right) {
288
471
  this.width = 0;
@@ -292,10 +475,17 @@ export class Rectangle {
292
475
  this.x = value;
293
476
  }
294
477
 
478
+ /**
479
+ * TBD.
480
+ * @returns {number} TBD.
481
+ */
295
482
  get right() {
296
483
  return this.x + this.width;
297
484
  }
298
485
 
486
+ /**
487
+ * TBD.
488
+ */
299
489
  set right(value) {
300
490
  if (value <= this.x) {
301
491
  this.width = 0;
@@ -304,42 +494,79 @@ export class Rectangle {
304
494
  }
305
495
  }
306
496
 
497
+ /**
498
+ * TBD.
499
+ * @returns {number} TBD.
500
+ */
307
501
  get volume() {
308
502
  return this.width * this.height;
309
503
  }
310
504
 
505
+ /**
506
+ * TBD.
507
+ * @returns {number} TBD.
508
+ */
311
509
  get perimeter() {
312
510
  return this.width * 2 + this.height * 2;
313
511
  }
314
512
 
513
+ /**
514
+ * TBD.
515
+ * @returns {number} TBD.
516
+ */
315
517
  get centerX() {
316
518
  return this.x + this.halfWidth;
317
519
  }
318
520
 
521
+ /**
522
+ * TBD.
523
+ */
319
524
  set centerX(value) {
320
525
  this.x = value - this.halfWidth;
321
526
  }
322
527
 
528
+ /**
529
+ * TBD.
530
+ * @returns {number} TBD.
531
+ */
323
532
  get centerY() {
324
533
  return this.y + this.halfHeight;
325
534
  }
326
535
 
536
+ /**
537
+ * TBD.
538
+ */
327
539
  set centerY(value) {
328
540
  this.y = value - this.halfHeight;
329
541
  }
330
542
 
543
+ /**
544
+ * TBD.
545
+ * @returns {number} TBD.
546
+ */
331
547
  get randomX() {
332
548
  return this.x + Math.random() * this.width;
333
549
  }
334
550
 
551
+ /**
552
+ * TBD.
553
+ * @returns {number} TBD.
554
+ */
335
555
  get randomY() {
336
556
  return this.y + Math.random() * this.height;
337
557
  }
338
558
 
559
+ /**
560
+ * TBD.
561
+ * @returns {boolean} TBD.
562
+ */
339
563
  get empty() {
340
564
  return !this.width || !this.height;
341
565
  }
342
566
 
567
+ /**
568
+ * TBD.
569
+ */
343
570
  set empty(value) {
344
571
  if (value === true) {
345
572
  this.setTo(0, 0, 0, 0);
@@ -1,9 +1,3 @@
1
- /**
2
- * @module geom/rounded_rectangle
3
- * @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
4
- * @author Andras Csizmadia <andras@vpmedia.hu>
5
- * @author Richard Davey <rich@photonstorm.com>
6
- */
7
1
  import { clone } from './util/rounded_rectangle';
8
2
  import { GEOM_ROUNDED_RECTANGLE } from '../core/const';
9
3
 
@@ -25,6 +19,12 @@ export class RoundedRectangle {
25
19
  this.type = GEOM_ROUNDED_RECTANGLE;
26
20
  }
27
21
 
22
+ /**
23
+ * TBD.
24
+ * @param {number} x - TBD.
25
+ * @param {number} y - TBD.
26
+ * @returns {boolean} TBD.
27
+ */
28
28
  contains(x, y) {
29
29
  if (this.width <= 0 || this.height <= 0) {
30
30
  return false;
@@ -37,6 +37,10 @@ export class RoundedRectangle {
37
37
  return false;
38
38
  }
39
39
 
40
+ /**
41
+ * TBD.
42
+ * @returns {RoundedRectangle} TBD.
43
+ */
40
44
  clone() {
41
45
  return clone(this);
42
46
  }
@@ -1,10 +1,4 @@
1
- /**
2
- * @module geom/util/circle
3
- * @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
4
- * @author Andras Csizmadia <andras@vpmedia.hu>
5
- * @author Richard Davey <rich@photonstorm.com>
6
- */
7
- import { Circle } from '../circle';
1
+ import { Circle } from '../circle';
8
2
  import { Point } from '../point';
9
3
  import { degToRad, distance } from '../../util/math';
10
4
 
@@ -63,8 +57,8 @@ export function intersects(a, b) {
63
57
  * @param {Circle} a - TBD.
64
58
  * @param {number} angle - TBD.
65
59
  * @param {boolean} asDegrees - TBD.
66
- * @param {Circle} output - TBD.
67
- * @returns {Circle} TBD.
60
+ * @param {Point} output - TBD.
61
+ * @returns {Point} TBD.
68
62
  */
69
63
  export function circumferencePoint(a, angle, asDegrees = false, output = null) {
70
64
  const result = output || new Point();
@@ -1,10 +1,3 @@
1
- /**
2
- * @module geom/util/ellipse
3
- * @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
4
- * @author Andras Csizmadia <andras@vpmedia.hu>
5
- * @author Richard Davey <rich@photonstorm.com>
6
- */
7
-
8
1
  /**
9
2
  * TBD.
10
3
  * @param {object} a - TBD.
@@ -1,11 +1,5 @@
1
- /**
2
- * @module geom/util/line
3
- * @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
4
- * @author Andras Csizmadia <andras@vpmedia.hu>
5
- * @author Richard Davey <rich@photonstorm.com>
6
- */
7
1
  import { Point } from '../point';
8
- import { Line } from '../line';
2
+ import { Line } from '../line';
9
3
  import { intersects as intersectsRect } from './rectangle';
10
4
 
11
5
  /**
@@ -31,7 +25,7 @@ export function clone(input, output = null) {
31
25
  * @param {object} f - TBD.
32
26
  * @param {boolean} asSegment - TBD.
33
27
  * @param {Point} output - TBD.
34
- * @returns {boolean} TBD.
28
+ * @returns {Point} TBD.
35
29
  */
36
30
  export function intersectsPoints(a, b, e, f, asSegment = true, output = null) {
37
31
  const result = output || new Point();
@@ -64,8 +58,8 @@ export function intersectsPoints(a, b, e, f, asSegment = true, output = null) {
64
58
  * @param {object} a - TBD.
65
59
  * @param {object} b - TBD.
66
60
  * @param {boolean} asSegment - TBD.
67
- * @param {object} result - TBD.
68
- * @returns {boolean} TBD.
61
+ * @param {Point} result - TBD.
62
+ * @returns {Point} TBD.
69
63
  */
70
64
  export function intersects(a, b, asSegment, result) {
71
65
  return intersectsPoints(a.start, a.end, b.start, b.end, asSegment, result);
@@ -93,10 +87,7 @@ export function intersectsRectangle(line, rect) {
93
87
  let t = 0;
94
88
  // If the start or end of the line is inside the rect then we assume
95
89
  // collision, as rects are solid for our use-case.
96
- if (
97
- (x1 >= bx1 && x1 <= bx2 && y1 >= by1 && y1 <= by2) ||
98
- (x2 >= bx1 && x2 <= bx2 && y2 >= by1 && y2 <= by2)
99
- ) {
90
+ if ((x1 >= bx1 && x1 <= bx2 && y1 >= by1 && y1 <= by2) || (x2 >= bx1 && x2 <= bx2 && y2 >= by1 && y2 <= by2)) {
100
91
  return true;
101
92
  }
102
93
  if (x1 < bx1 && x2 >= bx1) {
@@ -1,10 +1,4 @@
1
- /**
2
- * @module geom/util/matrix
3
- * @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
4
- * @author Andras Csizmadia <andras@vpmedia.hu>
5
- * @author Richard Davey <rich@photonstorm.com>
6
- */
7
- import { Matrix } from '../matrix';
1
+ import { Matrix } from '../matrix';
8
2
 
9
3
  /**
10
4
  * TBD.
@@ -1,9 +1,3 @@
1
- /**
2
- * @module geom/util/point
3
- * @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
4
- * @author Andras Csizmadia <andras@vpmedia.hu>
5
- * @author Richard Davey <rich@photonstorm.com>
6
- */
7
1
  import { Point } from '../point';
8
2
 
9
3
  /**
@@ -1,10 +1,4 @@
1
- /**
2
- * @module geom/util/polygon
3
- * @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
4
- * @author Andras Csizmadia <andras@vpmedia.hu>
5
- * @author Richard Davey <rich@photonstorm.com>
6
- */
7
- import { Polygon } from '../polygon';
1
+ import { Polygon } from '../polygon';
8
2
 
9
3
  /**
10
4
  * TBD.
@@ -1,10 +1,4 @@
1
- /**
2
- * @module geom/util/rectangle
3
- * @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
4
- * @author Andras Csizmadia <andras@vpmedia.hu>
5
- * @author Richard Davey <rich@photonstorm.com>
6
- */
7
- import { Rectangle } from '../rectangle';
1
+ import { Rectangle } from '../rectangle';
8
2
  import { Point } from '../point';
9
3
 
10
4
  /**
@@ -1,10 +1,4 @@
1
- /**
2
- * @module geom/util/rounded_rectangle
3
- * @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
4
- * @author Andras Csizmadia <andras@vpmedia.hu>
5
- * @author Richard Davey <rich@photonstorm.com>
6
- */
7
- import { RoundedRectangle } from '../rounded_rectangle';
1
+ import { RoundedRectangle } from '../rounded_rectangle';
8
2
 
9
3
  /**
10
4
  * TBD.