@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,27 +1,18 @@
1
- /**
2
- * @module display/graphics
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 { DisplayObject } from './display_object';
1
+ import { DisplayObject } from './display_object';
8
2
  import { Image } from './image';
9
- import { Game } from '../core/game';
10
- import { Rectangle } from '../geom/rectangle';
11
- import { RoundedRectangle } from '../geom/rounded_rectangle';
12
- import { Polygon } from '../geom/polygon';
13
- import { Circle } from '../geom/circle';
14
- import { Ellipse } from '../geom/ellipse';
3
+ import { Game } from '../core/game';
4
+ import { Rectangle } from '../geom/rectangle';
5
+ import { RoundedRectangle } from '../geom/rounded_rectangle';
6
+ import { Polygon } from '../geom/polygon';
7
+ import { Circle } from '../geom/circle';
8
+ import { Ellipse } from '../geom/ellipse';
15
9
  import { Point } from '../geom/point';
16
- import { GraphicsData } from './graphics_data';
10
+ import { GraphicsData } from './graphics_data';
17
11
  import { CanvasBuffer } from './canvas/buffer';
18
12
  import { textureFromCanvas } from './webgl/texture_util';
19
13
  import { renderGraphics as renderCanvasGraphics } from './canvas/graphics';
20
14
  import { renderGraphics as renderWebGLGraphics } from './webgl/graphics';
21
- import {
22
- renderCanvas as renderSpriteCanvas,
23
- renderWebGL as renderSpriteWebGL,
24
- } from './sprite_util';
15
+ import { renderCanvas as renderSpriteCanvas, renderWebGL as renderSpriteWebGL } from './sprite_util';
25
16
  import { getEmptyRectangle } from '../geom/util/rectangle';
26
17
  import { getIdentityMatrix } from '../geom/util/matrix';
27
18
  import {
@@ -64,12 +55,21 @@ export class Graphics extends DisplayObject {
64
55
  this.cachedSpriteDirty = false;
65
56
  }
66
57
 
58
+ /**
59
+ * TBD.
60
+ */
67
61
  destroy() {
68
62
  // TODO
69
63
  this.clear();
70
64
  super.destroy();
71
65
  }
72
66
 
67
+ /**
68
+ * TBD.
69
+ * @param lineWidth - TBD.
70
+ * @param color - TBD.
71
+ * @param alpha - TBD.
72
+ */
73
73
  lineStyle(lineWidth = 0, color = 0, alpha = 1) {
74
74
  this.lineWidth = lineWidth || 0;
75
75
  this.lineColor = color || 0;
@@ -88,11 +88,21 @@ export class Graphics extends DisplayObject {
88
88
  return this;
89
89
  }
90
90
 
91
+ /**
92
+ * TBD.
93
+ * @param {number} x - TBD.
94
+ * @param {number} y - TBD.
95
+ */
91
96
  moveTo(x, y) {
92
97
  this.drawShape(new Polygon([x, y]));
93
98
  return this;
94
99
  }
95
100
 
101
+ /**
102
+ * TBD.
103
+ * @param {number} x - TBD.
104
+ * @param {number} y - TBD.
105
+ */
96
106
  lineTo(x, y) {
97
107
  if (!this.currentPath) {
98
108
  this.moveTo(0, 0);
@@ -103,6 +113,13 @@ export class Graphics extends DisplayObject {
103
113
  return this;
104
114
  }
105
115
 
116
+ /**
117
+ * TBD.
118
+ * @param cpX - TBD.
119
+ * @param cpY - TBD.
120
+ * @param toX - TBD.
121
+ * @param toY - TBD.
122
+ */
106
123
  quadraticCurveTo(cpX, cpY, toX, toY) {
107
124
  if (this.currentPath) {
108
125
  if (this.currentPath.shape.points.length === 0) {
@@ -132,6 +149,15 @@ export class Graphics extends DisplayObject {
132
149
  return this;
133
150
  }
134
151
 
152
+ /**
153
+ * TBD.
154
+ * @param cpX - TBD.
155
+ * @param cpY - TBD.
156
+ * @param cpX2 - TBD.
157
+ * @param cpY2 - TBD.
158
+ * @param toX - TBD.
159
+ * @param toY - TBD.
160
+ */
135
161
  bezierCurveTo(cpX, cpY, cpX2, cpY2, toX, toY) {
136
162
  if (this.currentPath) {
137
163
  if (this.currentPath.shape.points.length === 0) {
@@ -167,6 +193,14 @@ export class Graphics extends DisplayObject {
167
193
  return this;
168
194
  }
169
195
 
196
+ /**
197
+ * TBD.
198
+ * @param x1 - TBD.
199
+ * @param y1 - TBD.
200
+ * @param x2 - TBD.
201
+ * @param y2 - TBD.
202
+ * @param radius - TBD.
203
+ */
170
204
  arcTo(x1, y1, x2, y2, radius) {
171
205
  if (this.currentPath) {
172
206
  if (this.currentPath.shape.points.length === 0) {
@@ -210,6 +244,16 @@ export class Graphics extends DisplayObject {
210
244
  return this;
211
245
  }
212
246
 
247
+ /**
248
+ * TBD.
249
+ * @param cx - TBD.
250
+ * @param cy - TBD.
251
+ * @param radius - TBD.
252
+ * @param startAngle - TBD.
253
+ * @param endAngle - TBD.
254
+ * @param anticlockwise - TBD.
255
+ * @param segments - TBD.
256
+ */
213
257
  arc(cx, cy, radius, startAngle, endAngle, anticlockwise = false, segments = 40) {
214
258
  // If we do this we can never draw a full circle
215
259
  if (startAngle === endAngle) {
@@ -246,16 +290,18 @@ export class Graphics extends DisplayObject {
246
290
  const angle = theta + startAngle + theta2 * real;
247
291
  const c = Math.cos(angle);
248
292
  const s = -Math.sin(angle);
249
- points.push(
250
- (cTheta * c + sTheta * s) * radius + cx,
251
- (cTheta * -s + sTheta * c) * radius + cy
252
- );
293
+ points.push((cTheta * c + sTheta * s) * radius + cx, (cTheta * -s + sTheta * c) * radius + cy);
253
294
  }
254
295
  this.dirty = true;
255
296
  this._boundsDirty = true;
256
297
  return this;
257
298
  }
258
299
 
300
+ /**
301
+ * TBD.
302
+ * @param color - TBD.
303
+ * @param alpha - TBD.
304
+ */
259
305
  beginFill(color = 0, alpha = 1) {
260
306
  this.filling = true;
261
307
  this.fillColor = color || 0;
@@ -270,6 +316,9 @@ export class Graphics extends DisplayObject {
270
316
  return this;
271
317
  }
272
318
 
319
+ /**
320
+ * TBD.
321
+ */
273
322
  endFill() {
274
323
  this.filling = false;
275
324
  this.fillColor = null;
@@ -277,26 +326,58 @@ export class Graphics extends DisplayObject {
277
326
  return this;
278
327
  }
279
328
 
329
+ /**
330
+ * TBD.
331
+ * @param {number} x - TBD.
332
+ * @param {number} y - TBD.
333
+ * @param {number} width - TBD.
334
+ * @param {number} height - TBD.
335
+ */
280
336
  drawRect(x, y, width, height) {
281
337
  this.drawShape(new Rectangle(x, y, width, height));
282
338
  return this;
283
339
  }
284
340
 
341
+ /**
342
+ * TBD.
343
+ * @param {number} x - TBD.
344
+ * @param {number} y - TBD.
345
+ * @param {number} width - TBD.
346
+ * @param {number} height - TBD.
347
+ * @param radius - TBD.
348
+ */
285
349
  drawRoundedRect(x, y, width, height, radius) {
286
350
  this.drawShape(new RoundedRectangle(x, y, width, height, radius));
287
351
  return this;
288
352
  }
289
353
 
354
+ /**
355
+ * TBD.
356
+ * @param {number} x - TBD.
357
+ * @param {number} y - TBD.
358
+ * @param diameter - TBD.
359
+ */
290
360
  drawCircle(x, y, diameter) {
291
361
  this.drawShape(new Circle(x, y, diameter));
292
362
  return this;
293
363
  }
294
364
 
365
+ /**
366
+ * TBD.
367
+ * @param {number} x - TBD.
368
+ * @param {number} y - TBD.
369
+ * @param {number} width - TBD.
370
+ * @param {number} height - TBD.
371
+ */
295
372
  drawEllipse(x, y, width, height) {
296
373
  this.drawShape(new Ellipse(x, y, width, height));
297
374
  return this;
298
375
  }
299
376
 
377
+ /**
378
+ * TBD.
379
+ * @param path - TBD.
380
+ */
300
381
  drawPolygon(path) {
301
382
  let points;
302
383
  if (path instanceof Polygon) {
@@ -317,6 +398,9 @@ export class Graphics extends DisplayObject {
317
398
  return this;
318
399
  }
319
400
 
401
+ /**
402
+ * TBD.
403
+ */
320
404
  clear() {
321
405
  this.lineWidth = 0;
322
406
  this.filling = false;
@@ -328,11 +412,18 @@ export class Graphics extends DisplayObject {
328
412
  return this;
329
413
  }
330
414
 
415
+ /**
416
+ * TBD.
417
+ */
331
418
  generateTexture() {
332
419
  // TODO
333
420
  console.warn('graphics.generateTexture() is not implemented');
334
421
  }
335
422
 
423
+ /**
424
+ * TBD.
425
+ * @param renderSession - TBD.
426
+ */
336
427
  renderWebGL(renderSession) {
337
428
  // if the sprite is not visible or the alpha is 0 then no need to render this element
338
429
  if (this.visible === false || this.alpha === 0 || this.isMask === true) {
@@ -360,8 +451,7 @@ export class Graphics extends DisplayObject {
360
451
  // check blend mode
361
452
  if (this.blendMode !== renderSession.spriteBatch.currentBlendMode) {
362
453
  renderSession.spriteBatch.currentBlendMode = this.blendMode;
363
- const blendModeWebGL =
364
- window.PhaserRegistry.blendModesWebGL[renderSession.spriteBatch.currentBlendMode];
454
+ const blendModeWebGL = window.PhaserRegistry.blendModesWebGL[renderSession.spriteBatch.currentBlendMode];
365
455
  renderSession.spriteBatch.gl.blendFunc(blendModeWebGL[0], blendModeWebGL[1]);
366
456
  }
367
457
  // check if the webgl graphic needs to be updated
@@ -390,6 +480,10 @@ export class Graphics extends DisplayObject {
390
480
  }
391
481
  }
392
482
 
483
+ /**
484
+ * TBD.
485
+ * @param renderSession - TBD.
486
+ */
393
487
  renderCanvas(renderSession) {
394
488
  // if the sprite is not visible or the alpha is 0 then no need to render this element
395
489
  if (this.visible === false || this.alpha === 0 || this.isMask === true) {
@@ -415,8 +509,7 @@ export class Graphics extends DisplayObject {
415
509
  const transform = this.worldTransform;
416
510
  if (this.blendMode !== renderSession.currentBlendMode) {
417
511
  renderSession.currentBlendMode = this.blendMode;
418
- context.globalCompositeOperation =
419
- window.PhaserRegistry.blendModesCanvas[renderSession.currentBlendMode];
512
+ context.globalCompositeOperation = window.PhaserRegistry.blendModesCanvas[renderSession.currentBlendMode];
420
513
  }
421
514
  if (this._mask) {
422
515
  renderSession.maskManager.pushMask(this._mask, renderSession);
@@ -443,6 +536,10 @@ export class Graphics extends DisplayObject {
443
536
  }
444
537
  }
445
538
 
539
+ /**
540
+ * TBD.
541
+ * @param matrix - TBD.
542
+ */
446
543
  getBounds(matrix = null) {
447
544
  if (!this.renderable) {
448
545
  return getEmptyRectangle();
@@ -499,6 +596,9 @@ export class Graphics extends DisplayObject {
499
596
  return this.currentBounds;
500
597
  }
501
598
 
599
+ /**
600
+ * TBD.
601
+ */
502
602
  getLocalBounds() {
503
603
  const matrixCache = this.worldTransform;
504
604
  this.worldTransform = getIdentityMatrix();
@@ -513,6 +613,11 @@ export class Graphics extends DisplayObject {
513
613
  return bounds;
514
614
  }
515
615
 
616
+ /**
617
+ * TBD.
618
+ * @param point - TBD.
619
+ * @param tempPoint - TBD.
620
+ */
516
621
  containsPoint(point, tempPoint) {
517
622
  this.worldTransform.applyInverse(point, tempPoint);
518
623
  const graphicsData = this.graphicsData;
@@ -527,6 +632,9 @@ export class Graphics extends DisplayObject {
527
632
  return false;
528
633
  }
529
634
 
635
+ /**
636
+ * TBD.
637
+ */
530
638
  updateLocalBounds() {
531
639
  let minX = Infinity;
532
640
  let maxX = -Infinity;
@@ -605,6 +713,9 @@ export class Graphics extends DisplayObject {
605
713
  this._localBounds.height = maxY - minY + padding * 2;
606
714
  }
607
715
 
716
+ /**
717
+ * TBD.
718
+ */
608
719
  generateCachedSprite() {
609
720
  const bounds = this.getLocalBounds();
610
721
  if (!this._cachedSprite) {
@@ -628,6 +739,9 @@ export class Graphics extends DisplayObject {
628
739
  this._cachedSprite.alpha = this.alpha;
629
740
  }
630
741
 
742
+ /**
743
+ * TBD.
744
+ */
631
745
  updateCachedSpriteTexture() {
632
746
  const cachedSprite = this._cachedSprite;
633
747
  const texture = cachedSprite.texture;
@@ -644,6 +758,9 @@ export class Graphics extends DisplayObject {
644
758
  texture.baseTexture.dirty();
645
759
  }
646
760
 
761
+ /**
762
+ * TBD.
763
+ */
647
764
  destroyCachedSprite() {
648
765
  if (!this._cachedSprite) {
649
766
  return;
@@ -652,6 +769,10 @@ export class Graphics extends DisplayObject {
652
769
  this._cachedSprite = null;
653
770
  }
654
771
 
772
+ /**
773
+ * TBD.
774
+ * @param shape - TBD.
775
+ */
655
776
  drawShape(shape) {
656
777
  if (this.currentPath) {
657
778
  // check current path!
@@ -684,6 +805,9 @@ export class Graphics extends DisplayObject {
684
805
  return data;
685
806
  }
686
807
 
808
+ /**
809
+ * TBD.
810
+ */
687
811
  postUpdate() {
688
812
  if (this._boundsDirty) {
689
813
  this.updateLocalBounds();
@@ -694,6 +818,11 @@ export class Graphics extends DisplayObject {
694
818
  }
695
819
  }
696
820
 
821
+ /**
822
+ * TBD.
823
+ * @param points - TBD.
824
+ * @param cull - TBD.
825
+ */
697
826
  drawTriangle(points, cull = false) {
698
827
  const triangle = new Polygon(points);
699
828
  if (cull) {
@@ -709,6 +838,12 @@ export class Graphics extends DisplayObject {
709
838
  }
710
839
  }
711
840
 
841
+ /**
842
+ * TBD.
843
+ * @param vertices - TBD.
844
+ * @param indices - TBD.
845
+ * @param cull - TBD.
846
+ */
712
847
  drawTriangles(vertices, indices, cull = false) {
713
848
  const point1 = new Point();
714
849
  const point2 = new Point();
@@ -1,12 +1,16 @@
1
- /**
2
- * @module display/graphics_data
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 './graphics_data_util';
8
2
 
9
3
  export class GraphicsData {
4
+ /**
5
+ * TBD.
6
+ * @param lineWidth - TBD.
7
+ * @param lineColor - TBD.
8
+ * @param lineAlpha - TBD.
9
+ * @param fillColor - TBD.
10
+ * @param fillAlpha - TBD.
11
+ * @param fill - TBD.
12
+ * @param shape - TBD.
13
+ */
10
14
  constructor(lineWidth, lineColor, lineAlpha, fillColor, fillAlpha, fill, shape) {
11
15
  this.lineWidth = lineWidth;
12
16
  this.lineColor = lineColor;
@@ -20,6 +24,10 @@ export class GraphicsData {
20
24
  this.type = shape.type;
21
25
  }
22
26
 
27
+ /**
28
+ * TBD.
29
+ * @returns {GraphicsData} TBD.
30
+ */
23
31
  clone() {
24
32
  return clone(this);
25
33
  }
@@ -1,15 +1,9 @@
1
- /**
2
- * @module display/graphics_data_util
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 { GraphicsData } from './graphics_data';
1
+ import { GraphicsData } from './graphics_data';
8
2
 
9
3
  /**
10
4
  * TBD.
11
5
  * @param {object} source - TBD.
12
- * @returns {object} TBD.
6
+ * @returns {GraphicsData} TBD.
13
7
  */
14
8
  export function clone(source) {
15
9
  return new GraphicsData(
@@ -1,13 +1,7 @@
1
- /**
2
- * @module display/group
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 { DisplayObject } from './display_object';
1
+ import { DisplayObject } from './display_object';
8
2
  import { Image } from './image';
9
- import { Signal } from '../core/signal';
10
- import { Game } from '../core/game';
3
+ import { Signal } from '../core/signal';
4
+ import { Game } from '../core/game';
11
5
  import { GROUP } from '../core/const';
12
6
 
13
7
  export const SORT_ASCENDING = -1;
@@ -51,6 +45,11 @@ export class Group extends DisplayObject {
51
45
  this._sortProperty = 'z';
52
46
  }
53
47
 
48
+ /**
49
+ * TBD.
50
+ * @param {boolean} destroyChildren - TBD.
51
+ * @param {boolean} soft - TBD.
52
+ */
54
53
  destroy(destroyChildren = true, soft = false) {
55
54
  if (this.game === null || this.ignoreDestroy) {
56
55
  return;
@@ -69,6 +68,13 @@ export class Group extends DisplayObject {
69
68
  }
70
69
  }
71
70
 
71
+ /**
72
+ * TBD.
73
+ * @param {DisplayObject} child - TBD.
74
+ * @param {boolean} silent - TBD.
75
+ * @param {number} index - TBD.
76
+ * @returns {DisplayObject} TBD.
77
+ */
72
78
  add(child, silent = false, index = -1) {
73
79
  if (child.parent === this) {
74
80
  return child;
@@ -92,10 +98,21 @@ export class Group extends DisplayObject {
92
98
  return child;
93
99
  }
94
100
 
101
+ /**
102
+ * TBD.
103
+ * @param {DisplayObject} child - TBD.
104
+ * @param {number} index - TBD.
105
+ * @param {boolean} silent - TBD.
106
+ */
95
107
  addAt(child, index, silent) {
96
108
  this.add(child, silent, index);
97
109
  }
98
110
 
111
+ /**
112
+ * TBD.
113
+ * @param {number} index - TBD.
114
+ * @returns {DisplayObject} TBD.
115
+ */
99
116
  getAt(index) {
100
117
  if (index < 0 || index >= this.children.length) {
101
118
  return -1;
@@ -103,6 +120,9 @@ export class Group extends DisplayObject {
103
120
  return this.getChildAt(index);
104
121
  }
105
122
 
123
+ /**
124
+ * TBD.
125
+ */
106
126
  updateZ() {
107
127
  let i = this.children.length;
108
128
  while (i) {
@@ -111,6 +131,10 @@ export class Group extends DisplayObject {
111
131
  }
112
132
  }
113
133
 
134
+ /**
135
+ * TBD.
136
+ * @returns {DisplayObject} TBD.
137
+ */
114
138
  next() {
115
139
  if (this.cursor) {
116
140
  // Wrap the cursor?
@@ -125,6 +149,10 @@ export class Group extends DisplayObject {
125
149
  return null;
126
150
  }
127
151
 
152
+ /**
153
+ * TBD.
154
+ * @returns {DisplayObject} TBD.
155
+ */
128
156
  previous() {
129
157
  if (this.cursor) {
130
158
  // Wrap the cursor?
@@ -139,11 +167,21 @@ export class Group extends DisplayObject {
139
167
  return null;
140
168
  }
141
169
 
170
+ /**
171
+ * TBD.
172
+ * @param {DisplayObject} child1 - TBD.
173
+ * @param {DisplayObject} child2 - TBD.
174
+ */
142
175
  swap(child1, child2) {
143
176
  this.swapChildren(child1, child2);
144
177
  this.updateZ();
145
178
  }
146
179
 
180
+ /**
181
+ * TBD.
182
+ * @param {DisplayObject} child - TBD.
183
+ * @returns {DisplayObject} TBD.
184
+ */
147
185
  bringToTop(child) {
148
186
  if (child.parent === this && this.getIndex(child) < this.children.length) {
149
187
  this.remove(child, false, true);
@@ -152,6 +190,11 @@ export class Group extends DisplayObject {
152
190
  return child;
153
191
  }
154
192
 
193
+ /**
194
+ * TBD.
195
+ * @param {DisplayObject} child - TBD.
196
+ * @returns {DisplayObject} TBD.
197
+ */
155
198
  sendToBack(child) {
156
199
  if (child.parent === this && this.getIndex(child) > 0) {
157
200
  this.remove(child, false, true);
@@ -160,15 +203,26 @@ export class Group extends DisplayObject {
160
203
  return child;
161
204
  }
162
205
 
206
+ /**
207
+ * TBD.
208
+ */
163
209
  reverse() {
164
210
  this.children.reverse();
165
211
  this.updateZ();
166
212
  }
167
213
 
214
+ /**
215
+ * TBD.
216
+ * @param {DisplayObject} child - TBD.
217
+ * @returns {number} TBD.
218
+ */
168
219
  getIndex(child) {
169
220
  return this.children.indexOf(child);
170
221
  }
171
222
 
223
+ /**
224
+ * TBD.
225
+ */
172
226
  preUpdate() {
173
227
  if (this.pendingDestroy) {
174
228
  this.destroy();
@@ -183,6 +237,9 @@ export class Group extends DisplayObject {
183
237
  }
184
238
  }
185
239
 
240
+ /**
241
+ * TBD.
242
+ */
186
243
  update() {
187
244
  let i = this.children.length;
188
245
  while (i) {
@@ -191,12 +248,22 @@ export class Group extends DisplayObject {
191
248
  }
192
249
  }
193
250
 
251
+ /**
252
+ * TBD.
253
+ */
194
254
  postUpdate() {
195
255
  for (let i = 0; i < this.children.length; i += 1) {
196
256
  this.children[i].postUpdate();
197
257
  }
198
258
  }
199
259
 
260
+ /**
261
+ * TBD.
262
+ * @param {DisplayObject} child - TBD.
263
+ * @param {boolean} destroy - TBD.
264
+ * @param {boolean} silent - TBD.
265
+ * @returns {boolean} TBD.
266
+ */
200
267
  remove(child, destroy = true, silent = false) {
201
268
  if (this.children.length === 0 || this.children.indexOf(child) === -1) {
202
269
  return false;
@@ -215,6 +282,12 @@ export class Group extends DisplayObject {
215
282
  return true;
216
283
  }
217
284
 
285
+ /**
286
+ * TBD.
287
+ * @param {boolean} destroy - TBD.
288
+ * @param {boolean} silent - TBD.
289
+ * @param {boolean} destroyTexture - TBD.
290
+ */
218
291
  removeAll(destroy = true, silent = false, destroyTexture = false) {
219
292
  if (this.children.length === 0) {
220
293
  return;