@vpmedia/phaser 1.15.0 → 1.16.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 +102 -6
  5. package/src/phaser/core/animation_manager.js +88 -10
  6. package/src/phaser/core/animation_parser.js +5 -18
  7. package/src/phaser/core/array_set.js +51 -5
  8. package/src/phaser/core/cache.js +291 -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 +116 -17
  20. package/src/phaser/core/input_handler.js +242 -42
  21. package/src/phaser/core/input_mouse.js +66 -5
  22. package/src/phaser/core/input_mspointer.js +40 -9
  23. package/src/phaser/core/input_pointer.js +79 -17
  24. package/src/phaser/core/input_touch.js +42 -5
  25. package/src/phaser/core/loader.js +274 -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 +74 -9
  59. package/src/phaser/display/image.js +85 -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 +105 -4
  107. package/types/phaser/core/animation.d.ts.map +1 -1
  108. package/types/phaser/core/animation_manager.d.ts +87 -0
  109. package/types/phaser/core/animation_manager.d.ts.map +1 -1
  110. package/types/phaser/core/animation_parser.d.ts +5 -4
  111. package/types/phaser/core/animation_parser.d.ts.map +1 -1
  112. package/types/phaser/core/array_set.d.ts +53 -7
  113. package/types/phaser/core/array_set.d.ts.map +1 -1
  114. package/types/phaser/core/cache.d.ts +346 -56
  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 +74 -7
  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 +114 -3
  137. package/types/phaser/core/input.d.ts.map +1 -1
  138. package/types/phaser/core/input_handler.d.ts +257 -24
  139. package/types/phaser/core/input_handler.d.ts.map +1 -1
  140. package/types/phaser/core/input_mouse.d.ts +51 -4
  141. package/types/phaser/core/input_mouse.d.ts.map +1 -1
  142. package/types/phaser/core/input_mspointer.d.ts +43 -9
  143. package/types/phaser/core/input_mspointer.d.ts.map +1 -1
  144. package/types/phaser/core/input_pointer.d.ts +78 -2
  145. package/types/phaser/core/input_pointer.d.ts.map +1 -1
  146. package/types/phaser/core/input_touch.d.ts +45 -8
  147. package/types/phaser/core/input_touch.d.ts.map +1 -1
  148. package/types/phaser/core/loader.d.ts +264 -19
  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 +17 -7
  152. package/types/phaser/core/raf.d.ts.map +1 -1
  153. package/types/phaser/core/scale_manager.d.ts +201 -6
  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 +93 -7
  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 +103 -2
  174. package/types/phaser/core/timer.d.ts.map +1 -1
  175. package/types/phaser/core/timer_event.d.ts +11 -5
  176. package/types/phaser/core/timer_event.d.ts.map +1 -1
  177. package/types/phaser/core/tween.d.ts +122 -2
  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 +62 -0
  210. package/types/phaser/display/group.d.ts.map +1 -1
  211. package/types/phaser/display/image.d.ts +66 -2
  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 destroyChildren - TBD.
51
+ * @param soft - TBD.
52
+ */
54
53
  destroy(destroyChildren = true, soft = false) {
55
54
  if (this.game === null || this.ignoreDestroy) {
56
55
  return;
@@ -69,6 +68,12 @@ export class Group extends DisplayObject {
69
68
  }
70
69
  }
71
70
 
71
+ /**
72
+ * TBD.
73
+ * @param child - TBD.
74
+ * @param silent - TBD.
75
+ * @param index - TBD.
76
+ */
72
77
  add(child, silent = false, index = -1) {
73
78
  if (child.parent === this) {
74
79
  return child;
@@ -92,10 +97,20 @@ export class Group extends DisplayObject {
92
97
  return child;
93
98
  }
94
99
 
100
+ /**
101
+ * TBD.
102
+ * @param child - TBD.
103
+ * @param index - TBD.
104
+ * @param silent - TBD.
105
+ */
95
106
  addAt(child, index, silent) {
96
107
  this.add(child, silent, index);
97
108
  }
98
109
 
110
+ /**
111
+ * TBD.
112
+ * @param index - TBD.
113
+ */
99
114
  getAt(index) {
100
115
  if (index < 0 || index >= this.children.length) {
101
116
  return -1;
@@ -103,6 +118,9 @@ export class Group extends DisplayObject {
103
118
  return this.getChildAt(index);
104
119
  }
105
120
 
121
+ /**
122
+ * TBD.
123
+ */
106
124
  updateZ() {
107
125
  let i = this.children.length;
108
126
  while (i) {
@@ -111,6 +129,9 @@ export class Group extends DisplayObject {
111
129
  }
112
130
  }
113
131
 
132
+ /**
133
+ * TBD.
134
+ */
114
135
  next() {
115
136
  if (this.cursor) {
116
137
  // Wrap the cursor?
@@ -125,6 +146,9 @@ export class Group extends DisplayObject {
125
146
  return null;
126
147
  }
127
148
 
149
+ /**
150
+ * TBD.
151
+ */
128
152
  previous() {
129
153
  if (this.cursor) {
130
154
  // Wrap the cursor?
@@ -139,11 +163,20 @@ export class Group extends DisplayObject {
139
163
  return null;
140
164
  }
141
165
 
166
+ /**
167
+ * TBD.
168
+ * @param child1 - TBD.
169
+ * @param child2 - TBD.
170
+ */
142
171
  swap(child1, child2) {
143
172
  this.swapChildren(child1, child2);
144
173
  this.updateZ();
145
174
  }
146
175
 
176
+ /**
177
+ * TBD.
178
+ * @param child - TBD.
179
+ */
147
180
  bringToTop(child) {
148
181
  if (child.parent === this && this.getIndex(child) < this.children.length) {
149
182
  this.remove(child, false, true);
@@ -152,6 +185,10 @@ export class Group extends DisplayObject {
152
185
  return child;
153
186
  }
154
187
 
188
+ /**
189
+ * TBD.
190
+ * @param child - TBD.
191
+ */
155
192
  sendToBack(child) {
156
193
  if (child.parent === this && this.getIndex(child) > 0) {
157
194
  this.remove(child, false, true);
@@ -160,15 +197,25 @@ export class Group extends DisplayObject {
160
197
  return child;
161
198
  }
162
199
 
200
+ /**
201
+ * TBD.
202
+ */
163
203
  reverse() {
164
204
  this.children.reverse();
165
205
  this.updateZ();
166
206
  }
167
207
 
208
+ /**
209
+ * TBD.
210
+ * @param child - TBD.
211
+ */
168
212
  getIndex(child) {
169
213
  return this.children.indexOf(child);
170
214
  }
171
215
 
216
+ /**
217
+ * TBD.
218
+ */
172
219
  preUpdate() {
173
220
  if (this.pendingDestroy) {
174
221
  this.destroy();
@@ -183,6 +230,9 @@ export class Group extends DisplayObject {
183
230
  }
184
231
  }
185
232
 
233
+ /**
234
+ * TBD.
235
+ */
186
236
  update() {
187
237
  let i = this.children.length;
188
238
  while (i) {
@@ -191,12 +241,21 @@ export class Group extends DisplayObject {
191
241
  }
192
242
  }
193
243
 
244
+ /**
245
+ * TBD.
246
+ */
194
247
  postUpdate() {
195
248
  for (let i = 0; i < this.children.length; i += 1) {
196
249
  this.children[i].postUpdate();
197
250
  }
198
251
  }
199
252
 
253
+ /**
254
+ * TBD.
255
+ * @param child - TBD.
256
+ * @param destroy - TBD.
257
+ * @param silent - TBD.
258
+ */
200
259
  remove(child, destroy = true, silent = false) {
201
260
  if (this.children.length === 0 || this.children.indexOf(child) === -1) {
202
261
  return false;
@@ -215,6 +274,12 @@ export class Group extends DisplayObject {
215
274
  return true;
216
275
  }
217
276
 
277
+ /**
278
+ * TBD.
279
+ * @param destroy - TBD.
280
+ * @param silent - TBD.
281
+ * @param destroyTexture - TBD.
282
+ */
218
283
  removeAll(destroy = true, silent = false, destroyTexture = false) {
219
284
  if (this.children.length === 0) {
220
285
  return;