@vpmedia/phaser 1.112.0 → 1.113.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 (295) hide show
  1. package/dist/index.js +1261 -1314
  2. package/dist/index.js.map +1 -1
  3. package/dist/phaser/core/animation.d.ts +14 -10
  4. package/dist/phaser/core/animation.d.ts.map +1 -1
  5. package/dist/phaser/core/animation_manager.d.ts +10 -8
  6. package/dist/phaser/core/animation_manager.d.ts.map +1 -1
  7. package/dist/phaser/core/animation_parser.d.ts +5 -4
  8. package/dist/phaser/core/animation_parser.d.ts.map +1 -1
  9. package/dist/phaser/core/array_set.d.ts.map +1 -1
  10. package/dist/phaser/core/cache.d.ts +4 -3
  11. package/dist/phaser/core/cache.d.ts.map +1 -1
  12. package/dist/phaser/core/const.d.ts.map +1 -1
  13. package/dist/phaser/core/device.d.ts.map +1 -1
  14. package/dist/phaser/core/device_util.d.ts.map +1 -1
  15. package/dist/phaser/core/dom.d.ts +3 -2
  16. package/dist/phaser/core/dom.d.ts.map +1 -1
  17. package/dist/phaser/core/event_manager.d.ts.map +1 -1
  18. package/dist/phaser/core/factory.d.ts +1 -1
  19. package/dist/phaser/core/factory.d.ts.map +1 -1
  20. package/dist/phaser/core/frame.d.ts.map +1 -1
  21. package/dist/phaser/core/frame_data.d.ts.map +1 -1
  22. package/dist/phaser/core/game.d.ts.map +1 -1
  23. package/dist/phaser/core/input.d.ts +8 -6
  24. package/dist/phaser/core/input.d.ts.map +1 -1
  25. package/dist/phaser/core/input_handler.d.ts +40 -30
  26. package/dist/phaser/core/input_handler.d.ts.map +1 -1
  27. package/dist/phaser/core/input_mouse.d.ts +3 -2
  28. package/dist/phaser/core/input_mouse.d.ts.map +1 -1
  29. package/dist/phaser/core/input_mspointer.d.ts +3 -2
  30. package/dist/phaser/core/input_mspointer.d.ts.map +1 -1
  31. package/dist/phaser/core/input_pointer.d.ts +6 -4
  32. package/dist/phaser/core/input_pointer.d.ts.map +1 -1
  33. package/dist/phaser/core/input_touch.d.ts +3 -2
  34. package/dist/phaser/core/input_touch.d.ts.map +1 -1
  35. package/dist/phaser/core/loader.d.ts +4 -3
  36. package/dist/phaser/core/loader.d.ts.map +1 -1
  37. package/dist/phaser/core/loader_parser.d.ts +9 -8
  38. package/dist/phaser/core/loader_parser.d.ts.map +1 -1
  39. package/dist/phaser/core/raf.d.ts +3 -2
  40. package/dist/phaser/core/raf.d.ts.map +1 -1
  41. package/dist/phaser/core/registry.d.ts +7 -0
  42. package/dist/phaser/core/registry.d.ts.map +1 -0
  43. package/dist/phaser/core/scale_manager.d.ts +1 -1
  44. package/dist/phaser/core/scale_manager.d.ts.map +1 -1
  45. package/dist/phaser/core/scene.d.ts +0 -1
  46. package/dist/phaser/core/scene.d.ts.map +1 -1
  47. package/dist/phaser/core/scene_manager.d.ts +1 -1
  48. package/dist/phaser/core/scene_manager.d.ts.map +1 -1
  49. package/dist/phaser/core/signal.d.ts +0 -1
  50. package/dist/phaser/core/signal.d.ts.map +1 -1
  51. package/dist/phaser/core/signal_binding.d.ts +4 -3
  52. package/dist/phaser/core/signal_binding.d.ts.map +1 -1
  53. package/dist/phaser/core/sound.d.ts +6 -4
  54. package/dist/phaser/core/sound.d.ts.map +1 -1
  55. package/dist/phaser/core/sound_manager.d.ts +3 -2
  56. package/dist/phaser/core/sound_manager.d.ts.map +1 -1
  57. package/dist/phaser/core/sound_sprite.d.ts +5 -4
  58. package/dist/phaser/core/sound_sprite.d.ts.map +1 -1
  59. package/dist/phaser/core/stage.d.ts +3 -2
  60. package/dist/phaser/core/stage.d.ts.map +1 -1
  61. package/dist/phaser/core/time.d.ts +1 -1
  62. package/dist/phaser/core/time.d.ts.map +1 -1
  63. package/dist/phaser/core/timer.d.ts +1 -1
  64. package/dist/phaser/core/timer.d.ts.map +1 -1
  65. package/dist/phaser/core/timer_event.d.ts.map +1 -1
  66. package/dist/phaser/core/tween.d.ts +10 -7
  67. package/dist/phaser/core/tween.d.ts.map +1 -1
  68. package/dist/phaser/core/tween_data.d.ts +3 -2
  69. package/dist/phaser/core/tween_data.d.ts.map +1 -1
  70. package/dist/phaser/core/tween_easing.d.ts.map +1 -1
  71. package/dist/phaser/core/tween_manager.d.ts +3 -2
  72. package/dist/phaser/core/tween_manager.d.ts.map +1 -1
  73. package/dist/phaser/core/world.d.ts +3 -2
  74. package/dist/phaser/core/world.d.ts.map +1 -1
  75. package/dist/phaser/display/bitmap_text.d.ts +3 -2
  76. package/dist/phaser/display/bitmap_text.d.ts.map +1 -1
  77. package/dist/phaser/display/button.d.ts +3 -2
  78. package/dist/phaser/display/button.d.ts.map +1 -1
  79. package/dist/phaser/display/canvas/buffer.d.ts.map +1 -1
  80. package/dist/phaser/display/canvas/graphics.d.ts +7 -6
  81. package/dist/phaser/display/canvas/graphics.d.ts.map +1 -1
  82. package/dist/phaser/display/canvas/pool.d.ts +2 -2
  83. package/dist/phaser/display/canvas/pool.d.ts.map +1 -1
  84. package/dist/phaser/display/canvas/renderer.d.ts +10 -8
  85. package/dist/phaser/display/canvas/renderer.d.ts.map +1 -1
  86. package/dist/phaser/display/canvas/tinter.d.ts +3 -2
  87. package/dist/phaser/display/canvas/tinter.d.ts.map +1 -1
  88. package/dist/phaser/display/canvas/util.d.ts +2 -2
  89. package/dist/phaser/display/canvas/util.d.ts.map +1 -1
  90. package/dist/phaser/display/display_object.d.ts +14 -12
  91. package/dist/phaser/display/display_object.d.ts.map +1 -1
  92. package/dist/phaser/display/graphics.d.ts +8 -5
  93. package/dist/phaser/display/graphics.d.ts.map +1 -1
  94. package/dist/phaser/display/graphics_data.d.ts.map +1 -1
  95. package/dist/phaser/display/graphics_data_util.d.ts.map +1 -1
  96. package/dist/phaser/display/group.d.ts +4 -3
  97. package/dist/phaser/display/group.d.ts.map +1 -1
  98. package/dist/phaser/display/image.d.ts +13 -10
  99. package/dist/phaser/display/image.d.ts.map +1 -1
  100. package/dist/phaser/display/sprite_batch.d.ts +3 -2
  101. package/dist/phaser/display/sprite_batch.d.ts.map +1 -1
  102. package/dist/phaser/display/sprite_util.d.ts +18 -15
  103. package/dist/phaser/display/sprite_util.d.ts.map +1 -1
  104. package/dist/phaser/display/text.d.ts +11 -9
  105. package/dist/phaser/display/text.d.ts.map +1 -1
  106. package/dist/phaser/display/webgl/abstract_filter.d.ts.map +1 -1
  107. package/dist/phaser/display/webgl/base_texture.d.ts.map +1 -1
  108. package/dist/phaser/display/webgl/blend_manager.d.ts +0 -1
  109. package/dist/phaser/display/webgl/blend_manager.d.ts.map +1 -1
  110. package/dist/phaser/display/webgl/earcut.d.ts +1 -1
  111. package/dist/phaser/display/webgl/earcut.d.ts.map +1 -1
  112. package/dist/phaser/display/webgl/earcut_node.d.ts.map +1 -1
  113. package/dist/phaser/display/webgl/fast_sprite_batch.d.ts +4 -3
  114. package/dist/phaser/display/webgl/fast_sprite_batch.d.ts.map +1 -1
  115. package/dist/phaser/display/webgl/filter_manager.d.ts +2 -1
  116. package/dist/phaser/display/webgl/filter_manager.d.ts.map +1 -1
  117. package/dist/phaser/display/webgl/filter_texture.d.ts +2 -1
  118. package/dist/phaser/display/webgl/filter_texture.d.ts.map +1 -1
  119. package/dist/phaser/display/webgl/graphics.d.ts +7 -6
  120. package/dist/phaser/display/webgl/graphics.d.ts.map +1 -1
  121. package/dist/phaser/display/webgl/graphics_data.d.ts +2 -1
  122. package/dist/phaser/display/webgl/graphics_data.d.ts.map +1 -1
  123. package/dist/phaser/display/webgl/render_texture.d.ts +4 -2
  124. package/dist/phaser/display/webgl/render_texture.d.ts.map +1 -1
  125. package/dist/phaser/display/webgl/renderer.d.ts +16 -11
  126. package/dist/phaser/display/webgl/renderer.d.ts.map +1 -1
  127. package/dist/phaser/display/webgl/shader/complex.d.ts +16 -6
  128. package/dist/phaser/display/webgl/shader/complex.d.ts.map +1 -1
  129. package/dist/phaser/display/webgl/shader/fast.d.ts +19 -7
  130. package/dist/phaser/display/webgl/shader/fast.d.ts.map +1 -1
  131. package/dist/phaser/display/webgl/shader/normal.d.ts +33 -12
  132. package/dist/phaser/display/webgl/shader/normal.d.ts.map +1 -1
  133. package/dist/phaser/display/webgl/shader/primitive.d.ts +15 -6
  134. package/dist/phaser/display/webgl/shader/primitive.d.ts.map +1 -1
  135. package/dist/phaser/display/webgl/shader/strip.d.ts +15 -6
  136. package/dist/phaser/display/webgl/shader/strip.d.ts.map +1 -1
  137. package/dist/phaser/display/webgl/shader_manager.d.ts +16 -11
  138. package/dist/phaser/display/webgl/shader_manager.d.ts.map +1 -1
  139. package/dist/phaser/display/webgl/sprite_batch.d.ts +29 -20
  140. package/dist/phaser/display/webgl/sprite_batch.d.ts.map +1 -1
  141. package/dist/phaser/display/webgl/stencil_manager.d.ts +12 -10
  142. package/dist/phaser/display/webgl/stencil_manager.d.ts.map +1 -1
  143. package/dist/phaser/display/webgl/texture.d.ts +3 -2
  144. package/dist/phaser/display/webgl/texture.d.ts.map +1 -1
  145. package/dist/phaser/display/webgl/texture_util.d.ts.map +1 -1
  146. package/dist/phaser/display/webgl/util.d.ts.map +1 -1
  147. package/dist/phaser/geom/circle.d.ts +4 -1
  148. package/dist/phaser/geom/circle.d.ts.map +1 -1
  149. package/dist/phaser/geom/ellipse.d.ts.map +1 -1
  150. package/dist/phaser/geom/line.d.ts +1 -1
  151. package/dist/phaser/geom/line.d.ts.map +1 -1
  152. package/dist/phaser/geom/matrix.d.ts.map +1 -1
  153. package/dist/phaser/geom/point.d.ts.map +1 -1
  154. package/dist/phaser/geom/polygon.d.ts.map +1 -1
  155. package/dist/phaser/geom/rectangle.d.ts.map +1 -1
  156. package/dist/phaser/geom/rounded_rectangle.d.ts.map +1 -1
  157. package/dist/phaser/geom/util/circle.d.ts.map +1 -1
  158. package/dist/phaser/geom/util/ellipse.d.ts +3 -2
  159. package/dist/phaser/geom/util/ellipse.d.ts.map +1 -1
  160. package/dist/phaser/geom/util/line.d.ts.map +1 -1
  161. package/dist/phaser/geom/util/matrix.d.ts +2 -2
  162. package/dist/phaser/geom/util/matrix.d.ts.map +1 -1
  163. package/dist/phaser/geom/util/point.d.ts.map +1 -1
  164. package/dist/phaser/geom/util/rectangle.d.ts +1 -1
  165. package/dist/phaser/geom/util/rectangle.d.ts.map +1 -1
  166. package/dist/phaser/util/math.d.ts.map +1 -1
  167. package/package.json +5 -5
  168. package/src/phaser/core/animation.ts +64 -60
  169. package/src/phaser/core/animation_manager.ts +50 -53
  170. package/src/phaser/core/animation_parser.ts +9 -9
  171. package/src/phaser/core/array_set.ts +16 -17
  172. package/src/phaser/core/cache.ts +92 -93
  173. package/src/phaser/core/const.ts +1 -1
  174. package/src/phaser/core/device.ts +24 -29
  175. package/src/phaser/core/device_util.ts +22 -26
  176. package/src/phaser/core/dom.ts +54 -65
  177. package/src/phaser/core/event_manager.ts +64 -94
  178. package/src/phaser/core/factory.ts +14 -14
  179. package/src/phaser/core/frame.ts +28 -28
  180. package/src/phaser/core/frame_data.test.ts +100 -0
  181. package/src/phaser/core/frame_data.ts +24 -24
  182. package/src/phaser/core/frame_util.ts +2 -2
  183. package/src/phaser/core/game.ts +47 -48
  184. package/src/phaser/core/input.ts +104 -110
  185. package/src/phaser/core/input_handler.test.ts +113 -0
  186. package/src/phaser/core/input_handler.ts +199 -218
  187. package/src/phaser/core/input_mouse.ts +71 -54
  188. package/src/phaser/core/input_mspointer.ts +52 -39
  189. package/src/phaser/core/input_pointer.ts +81 -80
  190. package/src/phaser/core/input_touch.ts +49 -36
  191. package/src/phaser/core/loader.ts +173 -152
  192. package/src/phaser/core/loader_parser.ts +39 -57
  193. package/src/phaser/core/raf.ts +8 -7
  194. package/src/phaser/core/registry.test.ts +31 -0
  195. package/src/phaser/core/registry.ts +9 -0
  196. package/src/phaser/core/scale_manager.ts +156 -152
  197. package/src/phaser/core/scene.ts +9 -13
  198. package/src/phaser/core/scene_manager.ts +47 -47
  199. package/src/phaser/core/signal.test.ts +4 -4
  200. package/src/phaser/core/signal.ts +41 -52
  201. package/src/phaser/core/signal_binding.ts +26 -25
  202. package/src/phaser/core/signal_dispatch.test.ts +180 -0
  203. package/src/phaser/core/sound.ts +75 -83
  204. package/src/phaser/core/sound_manager.ts +52 -51
  205. package/src/phaser/core/sound_sprite.ts +17 -16
  206. package/src/phaser/core/stage.ts +25 -24
  207. package/src/phaser/core/time.ts +52 -52
  208. package/src/phaser/core/timer.test.ts +187 -0
  209. package/src/phaser/core/timer.ts +82 -69
  210. package/src/phaser/core/timer_event.ts +10 -10
  211. package/src/phaser/core/tween.ts +90 -93
  212. package/src/phaser/core/tween_data.ts +45 -51
  213. package/src/phaser/core/tween_easing.test.ts +106 -0
  214. package/src/phaser/core/tween_easing.ts +151 -123
  215. package/src/phaser/core/tween_manager.ts +19 -18
  216. package/src/phaser/core/world.ts +4 -3
  217. package/src/phaser/display/bitmap_text.ts +56 -64
  218. package/src/phaser/display/button.ts +33 -32
  219. package/src/phaser/display/canvas/buffer.ts +8 -8
  220. package/src/phaser/display/canvas/graphics.ts +36 -37
  221. package/src/phaser/display/canvas/masker.ts +2 -2
  222. package/src/phaser/display/canvas/pool.test.ts +106 -0
  223. package/src/phaser/display/canvas/pool.ts +25 -27
  224. package/src/phaser/display/canvas/renderer.ts +32 -31
  225. package/src/phaser/display/canvas/tinter.ts +25 -25
  226. package/src/phaser/display/canvas/util.ts +7 -10
  227. package/src/phaser/display/display_object.ts +114 -118
  228. package/src/phaser/display/graphics.ts +121 -119
  229. package/src/phaser/display/graphics_data.ts +12 -12
  230. package/src/phaser/display/graphics_data_util.ts +2 -3
  231. package/src/phaser/display/group.ts +50 -57
  232. package/src/phaser/display/image.ts +55 -52
  233. package/src/phaser/display/sprite_batch.ts +3 -2
  234. package/src/phaser/display/sprite_util.ts +48 -54
  235. package/src/phaser/display/text.ts +199 -204
  236. package/src/phaser/display/webgl/abstract_filter.ts +9 -9
  237. package/src/phaser/display/webgl/base_texture.ts +21 -24
  238. package/src/phaser/display/webgl/blend_manager.ts +6 -10
  239. package/src/phaser/display/webgl/earcut.ts +73 -37
  240. package/src/phaser/display/webgl/earcut_node.ts +10 -10
  241. package/src/phaser/display/webgl/fast_sprite_batch.ts +34 -34
  242. package/src/phaser/display/webgl/filter_manager.ts +13 -12
  243. package/src/phaser/display/webgl/filter_texture.ts +14 -13
  244. package/src/phaser/display/webgl/graphics.ts +51 -57
  245. package/src/phaser/display/webgl/graphics_data.ts +15 -14
  246. package/src/phaser/display/webgl/mask_manager.ts +2 -2
  247. package/src/phaser/display/webgl/render_texture.ts +26 -25
  248. package/src/phaser/display/webgl/renderer.ts +57 -62
  249. package/src/phaser/display/webgl/shader/complex.ts +28 -12
  250. package/src/phaser/display/webgl/shader/fast.ts +30 -12
  251. package/src/phaser/display/webgl/shader/normal.ts +70 -57
  252. package/src/phaser/display/webgl/shader/primitive.ts +26 -11
  253. package/src/phaser/display/webgl/shader/shader.test.ts +148 -0
  254. package/src/phaser/display/webgl/shader/strip.ts +27 -12
  255. package/src/phaser/display/webgl/shader_manager.test.ts +124 -0
  256. package/src/phaser/display/webgl/shader_manager.ts +26 -34
  257. package/src/phaser/display/webgl/sprite_batch.ts +67 -61
  258. package/src/phaser/display/webgl/stencil_manager.ts +23 -34
  259. package/src/phaser/display/webgl/texture.ts +43 -50
  260. package/src/phaser/display/webgl/texture_util.ts +2 -3
  261. package/src/phaser/display/webgl/util.ts +26 -25
  262. package/src/phaser/geom/circle.test.ts +2 -3
  263. package/src/phaser/geom/circle.ts +36 -36
  264. package/src/phaser/geom/ellipse.test.ts +73 -71
  265. package/src/phaser/geom/ellipse.ts +14 -14
  266. package/src/phaser/geom/line.test.ts +5 -5
  267. package/src/phaser/geom/line.ts +35 -35
  268. package/src/phaser/geom/matrix.test.ts +1 -1
  269. package/src/phaser/geom/matrix.ts +27 -27
  270. package/src/phaser/geom/point.test.ts +1 -2
  271. package/src/phaser/geom/point.ts +35 -35
  272. package/src/phaser/geom/polygon.test.ts +82 -0
  273. package/src/phaser/geom/polygon.ts +16 -16
  274. package/src/phaser/geom/rectangle.test.ts +14 -14
  275. package/src/phaser/geom/rectangle.ts +83 -75
  276. package/src/phaser/geom/rounded_rectangle.test.ts +1 -7
  277. package/src/phaser/geom/rounded_rectangle.ts +9 -9
  278. package/src/phaser/geom/util/circle.test.ts +25 -23
  279. package/src/phaser/geom/util/circle.ts +9 -18
  280. package/src/phaser/geom/util/ellipse.test.ts +7 -5
  281. package/src/phaser/geom/util/ellipse.ts +3 -2
  282. package/src/phaser/geom/util/line.test.ts +10 -8
  283. package/src/phaser/geom/util/line.ts +6 -16
  284. package/src/phaser/geom/util/matrix.test.ts +20 -18
  285. package/src/phaser/geom/util/matrix.ts +8 -15
  286. package/src/phaser/geom/util/point.test.ts +8 -6
  287. package/src/phaser/geom/util/point.ts +24 -28
  288. package/src/phaser/geom/util/polygon.test.ts +12 -10
  289. package/src/phaser/geom/util/polygon.ts +2 -2
  290. package/src/phaser/geom/util/rectangle.test.ts +10 -8
  291. package/src/phaser/geom/util/rectangle.ts +18 -37
  292. package/src/phaser/geom/util/rounded_rectangle.test.ts +11 -9
  293. package/src/phaser/geom/util/rounded_rectangle.ts +1 -1
  294. package/src/phaser/util/math.test.ts +11 -11
  295. package/src/phaser/util/math.ts +29 -46
@@ -1,3 +1,5 @@
1
+ import type { Game } from '../core/game.js';
2
+ import type { Matrix } from '../geom/matrix.js';
1
3
  import {
2
4
  BLEND_NORMAL,
3
5
  GEOM_CIRCLE,
@@ -25,37 +27,37 @@ import { renderGraphics as renderWebGLGraphics } from './webgl/graphics.js';
25
27
  import { textureFromCanvas } from './webgl/texture_util.js';
26
28
 
27
29
  export class Graphics extends DisplayObject {
28
- declare type: any;
29
- declare renderable: any;
30
- fillAlpha!: any;
31
- lineWidth!: any;
32
- lineColor!: any;
33
- lineAlpha!: any;
34
- graphicsData!: any;
35
- declare tint: any;
36
- blendMode!: any;
37
- currentPath!: any;
38
- _webGL!: any;
39
- isMask!: any;
40
- boundsPadding!: any;
41
- _localBounds!: any;
42
- dirty!: any;
43
- clearDirty!: any;
44
- _boundsDirty!: any;
45
- _cacheAsBitmap!: any;
46
- webGLDirty!: any;
47
- cachedSpriteDirty!: any;
48
- declare _cachedSprite: any;
49
- filling!: any;
50
- fillColor!: any;
51
- _prevTint!: any;
30
+ declare public type: any;
31
+ declare public renderable: any;
32
+ public fillAlpha!: any;
33
+ public lineWidth!: any;
34
+ public lineColor!: any;
35
+ public lineAlpha!: any;
36
+ public graphicsData!: any;
37
+ declare public tint: any;
38
+ public blendMode!: any;
39
+ public currentPath!: any;
40
+ public _webGL!: any;
41
+ public isMask!: any;
42
+ public boundsPadding!: any;
43
+ public _localBounds!: any;
44
+ public dirty!: any;
45
+ public clearDirty!: any;
46
+ public _boundsDirty!: any;
47
+ public _cacheAsBitmap!: any;
48
+ public webGLDirty!: any;
49
+ public cachedSpriteDirty!: any;
50
+ declare public _cachedSprite: any;
51
+ public filling!: any;
52
+ public fillColor!: any;
53
+ public _prevTint!: any;
52
54
  /**
53
55
  * Creates a new Graphics object.
54
- * @param {import('../core/game.js').Game} game - The game instance.
56
+ * @param {Game} game - The game instance.
55
57
  * @param {number} x - The x coordinate of the graphics object.
56
58
  * @param {number} y - The y coordinate of the graphics object.
57
59
  */
58
- constructor(game: import('../core/game.js').Game, x: number = 0, y: number = 0) {
60
+ public constructor(game: Game, x = 0, y = 0) {
59
61
  super(game);
60
62
  /** @type {number} */
61
63
  this.type = GRAPHICS;
@@ -98,7 +100,7 @@ export class Graphics extends DisplayObject {
98
100
  /**
99
101
  * Destroys the graphics object and clears all data.
100
102
  */
101
- override destroy() {
103
+ public override destroy() {
102
104
  // TODO
103
105
  this.clear();
104
106
  super.destroy();
@@ -111,12 +113,12 @@ export class Graphics extends DisplayObject {
111
113
  * @param {number} alpha - The alpha (transparency) of the line to draw.
112
114
  * @returns {Graphics} This Graphics object for chaining.
113
115
  */
114
- lineStyle(lineWidth: number = 0, color: number = 0, alpha: number = 1) {
116
+ public lineStyle(lineWidth = 0, color = 0, alpha = 1) {
115
117
  this.lineWidth = lineWidth || 0;
116
118
  this.lineColor = color || 0;
117
- this.lineAlpha = alpha === undefined ? 1 : alpha;
119
+ this.lineAlpha = alpha ?? 1;
118
120
  if (this.currentPath) {
119
- if (this.currentPath.shape.points.length) {
121
+ if (this.currentPath.shape.points.length > 0) {
120
122
  // halfway through a line? start a new one!
121
123
  this.drawShape(new Polygon(this.currentPath.shape.points.slice(-2)));
122
124
  } else {
@@ -135,7 +137,7 @@ export class Graphics extends DisplayObject {
135
137
  * @param {number} y - The y coordinate to move to.
136
138
  * @returns {Graphics} This Graphics object for chaining.
137
139
  */
138
- moveTo(x: number, y: number) {
140
+ public moveTo(x: number, y: number) {
139
141
  this.drawShape(new Polygon([x, y]));
140
142
  return this;
141
143
  }
@@ -146,7 +148,7 @@ export class Graphics extends DisplayObject {
146
148
  * @param {number} y - The y coordinate to draw to.
147
149
  * @returns {Graphics} This Graphics object for chaining.
148
150
  */
149
- lineTo(x: number, y: number) {
151
+ public lineTo(x: number, y: number) {
150
152
  if (!this.currentPath) {
151
153
  this.moveTo(0, 0);
152
154
  }
@@ -164,7 +166,7 @@ export class Graphics extends DisplayObject {
164
166
  * @param {number} toY - The y coordinate to draw to.
165
167
  * @returns {Graphics} This Graphics object for chaining.
166
168
  */
167
- quadraticCurveTo(cpX: number, cpY: number, toX: number, toY: number) {
169
+ public quadraticCurveTo(cpX: number, cpY: number, toX: number, toY: number) {
168
170
  if (this.currentPath) {
169
171
  if (this.currentPath.shape.points.length === 0) {
170
172
  this.currentPath.shape.points = [0, 0];
@@ -175,12 +177,12 @@ export class Graphics extends DisplayObject {
175
177
  let xa;
176
178
  let ya;
177
179
  const n = 20;
178
- const points = this.currentPath.shape.points;
180
+ const { points } = this.currentPath.shape;
179
181
  if (points.length === 0) {
180
182
  this.moveTo(0, 0);
181
183
  }
182
- const fromX = points[points.length - 2];
183
- const fromY = points[points.length - 1];
184
+ const fromX = points.at(-2);
185
+ const fromY = points.at(-1);
184
186
  let j = 0;
185
187
  for (let i = 1; i <= n; i += 1) {
186
188
  j = i / n;
@@ -203,7 +205,7 @@ export class Graphics extends DisplayObject {
203
205
  * @param {number} toY - The y coordinate to draw to.
204
206
  * @returns {Graphics} This Graphics object for chaining.
205
207
  */
206
- bezierCurveTo(cpX: number, cpY: number, cpX2: number, cpY2: number, toX: number, toY: number) {
208
+ public bezierCurveTo(cpX: number, cpY: number, cpX2: number, cpY2: number, toX: number, toY: number) {
207
209
  if (this.currentPath) {
208
210
  if (this.currentPath.shape.points.length === 0) {
209
211
  this.currentPath.shape.points = [0, 0];
@@ -217,9 +219,9 @@ export class Graphics extends DisplayObject {
217
219
  let dt3;
218
220
  let t2;
219
221
  let t3;
220
- const points = this.currentPath.shape.points;
221
- const fromX = points[points.length - 2];
222
- const fromY = points[points.length - 1];
222
+ const { points } = this.currentPath.shape;
223
+ const fromX = points.at(-2);
224
+ const fromY = points.at(-1);
223
225
  let j = 0;
224
226
  for (let i = 1; i <= n; i += 1) {
225
227
  j = i / n;
@@ -247,7 +249,7 @@ export class Graphics extends DisplayObject {
247
249
  * @param {number} radius - The radius of the arc.
248
250
  * @returns {Graphics} This Graphics object for chaining.
249
251
  */
250
- arcTo(x1: number, y1: number, x2: number, y2: number, radius: number) {
252
+ public arcTo(x1: number, y1: number, x2: number, y2: number, radius: number) {
251
253
  if (this.currentPath) {
252
254
  if (this.currentPath.shape.points.length === 0) {
253
255
  this.currentPath.shape.points.push(x1, y1);
@@ -255,16 +257,16 @@ export class Graphics extends DisplayObject {
255
257
  } else {
256
258
  this.moveTo(x1, y1);
257
259
  }
258
- const points = this.currentPath.shape.points;
259
- const fromX = points[points.length - 2];
260
- const fromY = points[points.length - 1];
260
+ const { points } = this.currentPath.shape;
261
+ const fromX = points.at(-2);
262
+ const fromY = points.at(-1);
261
263
  const a1 = fromY - y1;
262
264
  const b1 = fromX - x1;
263
265
  const a2 = y2 - y1;
264
266
  const b2 = x2 - x1;
265
267
  const mm = Math.abs(a1 * b2 - b1 * a2);
266
268
  if (mm < 1e-8 || radius === 0) {
267
- if (points[points.length - 2] !== x1 || points[points.length - 1] !== y1) {
269
+ if (points.at(-2) !== x1 || points.at(-1) !== y1) {
268
270
  points.push(x1, y1);
269
271
  }
270
272
  } else {
@@ -301,14 +303,14 @@ export class Graphics extends DisplayObject {
301
303
  * @param {number} segments - The number of segments to use for drawing the arc.
302
304
  * @returns {Graphics} This Graphics object for chaining.
303
305
  */
304
- arc(
306
+ public arc(
305
307
  cx: number,
306
308
  cy: number,
307
309
  radius: number,
308
310
  startAngle: number,
309
311
  endAngle: number,
310
- anticlockwise: boolean = false,
311
- segments: number = 40
312
+ anticlockwise = false,
313
+ segments = 40
312
314
  ) {
313
315
  // If we do this we can never draw a full circle
314
316
  if (startAngle === endAngle) {
@@ -333,7 +335,7 @@ export class Graphics extends DisplayObject {
333
335
  this.moveTo(startX, startY);
334
336
  }
335
337
  // currentPath will always exist after calling a moveTo
336
- const points = this.currentPath.shape.points;
338
+ const { points } = this.currentPath.shape;
337
339
  const theta = sweep / (segs * 2);
338
340
  const theta2 = theta * 2;
339
341
  const cTheta = Math.cos(theta);
@@ -358,10 +360,10 @@ export class Graphics extends DisplayObject {
358
360
  * @param {number} alpha - The fill alpha (transparency) to use.
359
361
  * @returns {Graphics} This Graphics object for chaining.
360
362
  */
361
- beginFill(color: number = 0, alpha: number = 1) {
363
+ public beginFill(color = 0, alpha = 1) {
362
364
  this.filling = true;
363
365
  this.fillColor = color || 0;
364
- this.fillAlpha = alpha === undefined ? 1 : alpha;
366
+ this.fillAlpha = alpha ?? 1;
365
367
  if (this.currentPath) {
366
368
  if (this.currentPath.shape.points.length <= 2) {
367
369
  this.currentPath.fill = this.filling;
@@ -376,7 +378,7 @@ export class Graphics extends DisplayObject {
376
378
  * Ends the current fill operation.
377
379
  * @returns {Graphics} This Graphics object for chaining.
378
380
  */
379
- endFill() {
381
+ public endFill() {
380
382
  this.filling = false;
381
383
  this.fillColor = null;
382
384
  this.fillAlpha = 1;
@@ -391,7 +393,7 @@ export class Graphics extends DisplayObject {
391
393
  * @param {number} height - The height of the rectangle.
392
394
  * @returns {Graphics} This Graphics object for chaining.
393
395
  */
394
- drawRect(x: number, y: number, width: number, height: number) {
396
+ public drawRect(x: number, y: number, width: number, height: number) {
395
397
  this.drawShape(new Rectangle(x, y, width, height));
396
398
  return this;
397
399
  }
@@ -405,7 +407,7 @@ export class Graphics extends DisplayObject {
405
407
  * @param {number} radius - The radius of the rounded corners.
406
408
  * @returns {Graphics} This Graphics object for chaining.
407
409
  */
408
- drawRoundedRect(x: number, y: number, width: number, height: number, radius: number) {
410
+ public drawRoundedRect(x: number, y: number, width: number, height: number, radius: number) {
409
411
  this.drawShape(new RoundedRectangle(x, y, width, height, radius));
410
412
  return this;
411
413
  }
@@ -417,7 +419,7 @@ export class Graphics extends DisplayObject {
417
419
  * @param {number} diameter - The diameter of the circle.
418
420
  * @returns {Graphics} This Graphics object for chaining.
419
421
  */
420
- drawCircle(x: number, y: number, diameter: number) {
422
+ public drawCircle(x: number, y: number, diameter: number) {
421
423
  this.drawShape(new Circle(x, y, diameter));
422
424
  return this;
423
425
  }
@@ -430,7 +432,7 @@ export class Graphics extends DisplayObject {
430
432
  * @param {number} height - The height of the ellipse.
431
433
  * @returns {Graphics} This Graphics object for chaining.
432
434
  */
433
- drawEllipse(x: number, y: number, width: number, height: number) {
435
+ public drawEllipse(x: number, y: number, width: number, height: number) {
434
436
  this.drawShape(new Ellipse(x, y, width, height));
435
437
  return this;
436
438
  }
@@ -440,7 +442,7 @@ export class Graphics extends DisplayObject {
440
442
  * @param {Polygon} path - The polygon to draw.
441
443
  * @returns {Graphics} This Graphics object for chaining.
442
444
  */
443
- drawPolygon(path: Polygon) {
445
+ public drawPolygon(path: Polygon) {
444
446
  let points;
445
447
  if (path instanceof Polygon) {
446
448
  points = path.points;
@@ -464,7 +466,7 @@ export class Graphics extends DisplayObject {
464
466
  * Clears all graphics data.
465
467
  * @returns {Graphics} This Graphics object for chaining.
466
468
  */
467
- clear() {
469
+ public clear() {
468
470
  this.lineWidth = 0;
469
471
  this.filling = false;
470
472
  this.dirty = true;
@@ -478,7 +480,7 @@ export class Graphics extends DisplayObject {
478
480
  /**
479
481
  * Generates a texture from the graphics object (not implemented).
480
482
  */
481
- override generateTexture() {
483
+ public override generateTexture() {
482
484
  // TODO
483
485
  this.game.logger.warn('graphics.generateTexture() is not implemented');
484
486
  }
@@ -487,9 +489,9 @@ export class Graphics extends DisplayObject {
487
489
  * Renders the graphics object using WebGL.
488
490
  * @param {object} renderSession - The render session to use.
489
491
  */
490
- override renderWebGL(renderSession: any) {
492
+ public override renderWebGL(renderSession: any) {
491
493
  // if the sprite is not visible or the alpha is 0 then no need to render this element
492
- if (this.visible === false || this.alpha === 0 || this.isMask === true) {
494
+ if (!this.visible || this.alpha === 0 || this.isMask === true) {
493
495
  return;
494
496
  }
495
497
  if (this._cacheAsBitmap) {
@@ -514,7 +516,7 @@ export class Graphics extends DisplayObject {
514
516
  // check blend mode
515
517
  if (this.blendMode !== renderSession.spriteBatch.currentBlendMode) {
516
518
  renderSession.spriteBatch.currentBlendMode = this.blendMode;
517
- const blendModeWebGL = window.PhaserRegistry.blendModesWebGL[renderSession.spriteBatch.currentBlendMode];
519
+ const blendModeWebGL = globalThis.PhaserRegistry.blendModesWebGL[renderSession.spriteBatch.currentBlendMode]!;
518
520
  renderSession.spriteBatch.gl.blendFunc(blendModeWebGL[0], blendModeWebGL[1]);
519
521
  }
520
522
  // check if the webgl graphic needs to be updated
@@ -524,11 +526,11 @@ export class Graphics extends DisplayObject {
524
526
  }
525
527
  renderWebGLGraphics(this, renderSession);
526
528
  // only render if it has children!
527
- if (this.children.length) {
529
+ if (this.children.length > 0) {
528
530
  renderSession.spriteBatch.start();
529
531
  // simple render children!
530
- for (let i = 0; i < this.children.length; i += 1) {
531
- this.children[i].renderWebGL(renderSession);
532
+ for (const child of this.children) {
533
+ child.renderWebGL(renderSession);
532
534
  }
533
535
  renderSession.spriteBatch.stop();
534
536
  }
@@ -547,9 +549,9 @@ export class Graphics extends DisplayObject {
547
549
  * Renders the graphics object using Canvas.
548
550
  * @param {object} renderSession - The render session to use.
549
551
  */
550
- override renderCanvas(renderSession: any) {
552
+ public override renderCanvas(renderSession: any) {
551
553
  // if the sprite is not visible or the alpha is 0 then no need to render this element
552
- if (this.visible === false || this.alpha === 0 || this.isMask === true) {
554
+ if (!this.visible || this.alpha === 0 || this.isMask === true) {
553
555
  return;
554
556
  }
555
557
  // if the tint has changed, set the graphics object to dirty.
@@ -568,16 +570,16 @@ export class Graphics extends DisplayObject {
568
570
  this._cachedSprite.alpha = this.alpha;
569
571
  renderSpriteCanvas(this._cachedSprite, renderSession);
570
572
  } else {
571
- const context = renderSession.context;
573
+ const { context } = renderSession;
572
574
  const transform = this.worldTransform;
573
575
  if (this.blendMode !== renderSession.currentBlendMode) {
574
576
  renderSession.currentBlendMode = this.blendMode;
575
- context.globalCompositeOperation = window.PhaserRegistry.blendModesCanvas[renderSession.currentBlendMode];
577
+ context.globalCompositeOperation = globalThis.PhaserRegistry.blendModesCanvas[renderSession.currentBlendMode];
576
578
  }
577
579
  if (this._mask) {
578
580
  renderSession.maskManager.pushMask(this._mask, renderSession);
579
581
  }
580
- const resolution = renderSession.resolution;
582
+ const { resolution } = renderSession;
581
583
  const tx = transform.tx * renderSession.resolution + renderSession.shakeX;
582
584
  const ty = transform.ty * renderSession.resolution + renderSession.shakeY;
583
585
  context.setTransform(
@@ -590,8 +592,8 @@ export class Graphics extends DisplayObject {
590
592
  );
591
593
  renderCanvasGraphics(this, context);
592
594
  // simple render children!
593
- for (let i = 0; i < this.children.length; i += 1) {
594
- this.children[i].renderCanvas(renderSession);
595
+ for (const child of this.children) {
596
+ child.renderCanvas(renderSession);
595
597
  }
596
598
  if (this._mask) {
597
599
  renderSession.maskManager.popMask(renderSession);
@@ -601,10 +603,10 @@ export class Graphics extends DisplayObject {
601
603
 
602
604
  /**
603
605
  * Gets the bounds of the graphics object.
604
- * @param {import('../geom/matrix.js').Matrix} matrix - The transformation matrix to use.
606
+ * @param {Matrix} matrix - The transformation matrix to use.
605
607
  * @returns {Rectangle} The bounds rectangle of the graphics object.
606
608
  */
607
- override getBounds(matrix: import('../geom/matrix.js').Matrix | null = null) {
609
+ public override getBounds(matrix: Matrix | null = null) {
608
610
  if (!this.renderable) {
609
611
  return getEmptyRectangle();
610
612
  }
@@ -621,13 +623,13 @@ export class Graphics extends DisplayObject {
621
623
  const w1 = bounds.width + bounds.x;
622
624
  const h0 = bounds.y;
623
625
  const h1 = bounds.height + bounds.y;
624
- const worldTransform = matrix || this.worldTransform;
625
- const a = worldTransform.a;
626
- const b = worldTransform.b;
627
- const c = worldTransform.c;
628
- const d = worldTransform.d;
629
- const tx = worldTransform.tx;
630
- const ty = worldTransform.ty;
626
+ const worldTransform = matrix ?? this.worldTransform;
627
+ const { a } = worldTransform;
628
+ const { b } = worldTransform;
629
+ const { c } = worldTransform;
630
+ const { d } = worldTransform;
631
+ const { tx } = worldTransform;
632
+ const { ty } = worldTransform;
631
633
  const x1 = a * w1 + c * h1 + tx;
632
634
  const y1 = d * h1 + b * w1 + ty;
633
635
  const x2 = a * w0 + c * h1 + tx;
@@ -664,16 +666,16 @@ export class Graphics extends DisplayObject {
664
666
  * Gets the local bounds of the graphics object.
665
667
  * @returns {Rectangle} The local bounds rectangle of the graphics object.
666
668
  */
667
- override getLocalBounds() {
669
+ public override getLocalBounds() {
668
670
  const matrixCache = this.worldTransform;
669
671
  this.worldTransform = getIdentityMatrix();
670
- for (let i = 0; i < this.children.length; i += 1) {
671
- this.children[i].updateTransform();
672
+ for (const child of this.children) {
673
+ child.updateTransform();
672
674
  }
673
675
  const bounds = this.getBounds();
674
676
  this.worldTransform = matrixCache;
675
- for (let i = 0; i < this.children.length; i += 1) {
676
- this.children[i].updateTransform();
677
+ for (const child of this.children) {
678
+ child.updateTransform();
677
679
  }
678
680
  return bounds;
679
681
  }
@@ -684,9 +686,9 @@ export class Graphics extends DisplayObject {
684
686
  * @param {Point} tempPoint - A temporary point object to use.
685
687
  * @returns {boolean} True if the graphics object contains the point, otherwise false.
686
688
  */
687
- containsPoint(point: Point, tempPoint: Point) {
689
+ public containsPoint(point: Point, tempPoint: Point) {
688
690
  this.worldTransform.applyInverse(point, tempPoint);
689
- const graphicsData = this.graphicsData;
691
+ const { graphicsData } = this;
690
692
  for (let i = 0; i < graphicsData.length; i += 0) {
691
693
  const data = graphicsData[i];
692
694
  if (data.fill && data.shape) {
@@ -701,22 +703,21 @@ export class Graphics extends DisplayObject {
701
703
  /**
702
704
  * Updates the local bounds of the graphics object.
703
705
  */
704
- updateLocalBounds() {
706
+ public updateLocalBounds() {
705
707
  let minX = Infinity;
706
708
  let maxX = -Infinity;
707
709
  let minY = Infinity;
708
710
  let maxY = -Infinity;
709
- if (this.graphicsData.length) {
711
+ if (this.graphicsData.length > 0) {
710
712
  let shape;
711
713
  let points;
712
714
  let x;
713
715
  let y;
714
716
  let w;
715
717
  let h;
716
- for (let i = 0; i < this.graphicsData.length; i += 1) {
717
- const data = this.graphicsData[i];
718
- const type = data.type;
719
- const lineWidth = data.lineWidth;
718
+ for (const data of this.graphicsData) {
719
+ const { type } = data;
720
+ const { lineWidth } = data;
720
721
  shape = data.shape;
721
722
  if (type === GEOM_RECTANGLE || type === GEOM_ROUNDED_RECTANGLE) {
722
723
  x = shape.x - lineWidth / 2;
@@ -782,7 +783,7 @@ export class Graphics extends DisplayObject {
782
783
  /**
783
784
  * Generates a cached sprite representation of the graphics object.
784
785
  */
785
- override generateCachedSprite() {
786
+ public override generateCachedSprite() {
786
787
  const bounds = this.getLocalBounds();
787
788
  if (!this._cachedSprite) {
788
789
  const canvasBuffer = new CanvasBuffer(bounds.width, bounds.height);
@@ -808,10 +809,10 @@ export class Graphics extends DisplayObject {
808
809
  /**
809
810
  * Updates the cached sprite texture.
810
811
  */
811
- updateCachedSpriteTexture() {
812
+ public updateCachedSpriteTexture() {
812
813
  const cachedSprite = this._cachedSprite;
813
- const texture = cachedSprite.texture;
814
- const canvas = cachedSprite.buffer.canvas;
814
+ const { texture } = cachedSprite;
815
+ const { canvas } = cachedSprite.buffer;
815
816
  texture.baseTexture.width = canvas.width;
816
817
  texture.baseTexture.height = canvas.height;
817
818
  texture.crop.width = canvas.width;
@@ -827,7 +828,7 @@ export class Graphics extends DisplayObject {
827
828
  /**
828
829
  * Destroys the cached sprite.
829
830
  */
830
- override destroyCachedSprite() {
831
+ public override destroyCachedSprite() {
831
832
  if (!this._cachedSprite) {
832
833
  return;
833
834
  }
@@ -840,7 +841,7 @@ export class Graphics extends DisplayObject {
840
841
  * @param {object} shape - The shape to draw.
841
842
  * @returns {GraphicsData} The graphics data for the drawn shape.
842
843
  */
843
- drawShape(shape: any) {
844
+ public drawShape(shape: any) {
844
845
  if (this.currentPath) {
845
846
  // check current path!
846
847
  if (this.currentPath.shape.points.length <= 2) {
@@ -875,13 +876,13 @@ export class Graphics extends DisplayObject {
875
876
  /**
876
877
  * Performs post-update operations for the graphics object.
877
878
  */
878
- override postUpdate() {
879
+ public override postUpdate() {
879
880
  if (this._boundsDirty) {
880
881
  this.updateLocalBounds();
881
882
  this._boundsDirty = false;
882
883
  }
883
- for (let i = 0; i < this.children.length; i += 1) {
884
- this.children[i].postUpdate();
884
+ for (const child of this.children) {
885
+ child.postUpdate();
885
886
  }
886
887
  }
887
888
 
@@ -890,12 +891,13 @@ export class Graphics extends DisplayObject {
890
891
  * @param {Point[]} points - The points of the triangle.
891
892
  * @param {boolean} cull - Whether to perform backface culling.
892
893
  */
893
- drawTriangle(points: Point[], cull: boolean = false) {
894
+ public drawTriangle(points: Point[], cull = false) {
894
895
  const triangle = new Polygon(points);
895
896
  if (cull) {
896
- const cameraToFace = new Point(0 - points[0].x, 0 - points[0].y);
897
- const ab = new Point(points[1].x - points[0].x, points[1].y - points[0].y);
898
- const cb = new Point(points[1].x - points[2].x, points[1].y - points[2].y);
897
+ const [a, b, c] = points as [Point, Point, Point];
898
+ const cameraToFace = new Point(0 - a.x, 0 - a.y);
899
+ const ab = new Point(b.x - a.x, b.y - a.y);
900
+ const cb = new Point(b.x - c.x, b.y - c.y);
899
901
  const faceNormal = cb.cross(ab);
900
902
  if (cameraToFace.dot(faceNormal as any) > 0) {
901
903
  this.drawPolygon(triangle);
@@ -911,7 +913,7 @@ export class Graphics extends DisplayObject {
911
913
  * @param {number[]} indices - The indices of the vertices to use.
912
914
  * @param {boolean} cull - Whether to perform backface culling.
913
915
  */
914
- drawTriangles(vertices: any, indices: number[], cull: boolean = false) {
916
+ public drawTriangles(vertices: any, indices: number[], cull = false) {
915
917
  const point1 = new Point();
916
918
  const point2 = new Point();
917
919
  const point3 = new Point();
@@ -924,20 +926,20 @@ export class Graphics extends DisplayObject {
924
926
  }
925
927
  } else {
926
928
  for (i = 0; i < vertices.length / 6; i += 1) {
927
- point1.x = vertices[i * 6 + 0];
928
- point1.y = vertices[i * 6 + 1];
929
- point2.x = vertices[i * 6 + 2];
930
- point2.y = vertices[i * 6 + 3];
931
- point3.x = vertices[i * 6 + 4];
932
- point3.y = vertices[i * 6 + 5];
929
+ point1.x = vertices[i * 6 + 0]!;
930
+ point1.y = vertices[i * 6 + 1]!;
931
+ point2.x = vertices[i * 6 + 2]!;
932
+ point2.y = vertices[i * 6 + 3]!;
933
+ point3.x = vertices[i * 6 + 4]!;
934
+ point3.y = vertices[i * 6 + 5]!;
933
935
  this.drawTriangle([point1, point2, point3], cull);
934
936
  }
935
937
  }
936
938
  } else if (vertices[0] instanceof Point) {
937
939
  for (i = 0; i < indices.length / 3; i += 1) {
938
- points.push(vertices[indices[i * 3]]);
939
- points.push(vertices[indices[i * 3 + 1]]);
940
- points.push(vertices[indices[i * 3 + 2]]);
940
+ points.push(vertices[indices[i * 3]!]);
941
+ points.push(vertices[indices[i * 3 + 1]!]);
942
+ points.push(vertices[indices[i * 3 + 2]!]);
941
943
  if (points.length === 3) {
942
944
  this.drawTriangle(points, cull);
943
945
  points = [];
@@ -945,8 +947,8 @@ export class Graphics extends DisplayObject {
945
947
  }
946
948
  } else {
947
949
  for (i = 0; i < indices.length; i += 1) {
948
- point1.x = vertices[indices[i] * 2];
949
- point1.y = vertices[indices[i] * 2 + 1];
950
+ point1.x = vertices[indices[i]! * 2]!;
951
+ point1.y = vertices[indices[i]! * 2 + 1]!;
950
952
  points.push(point1.copyTo({} as any));
951
953
  if (points.length === 3) {
952
954
  this.drawTriangle(points, cull);
@@ -1,16 +1,16 @@
1
1
  import { clone } from './graphics_data_util.js';
2
2
 
3
3
  export class GraphicsData {
4
- lineWidth!: any;
5
- lineColor!: any;
6
- lineAlpha!: any;
7
- _lineTint!: any;
8
- fillColor!: any;
9
- fillAlpha!: any;
10
- _fillTint!: any;
11
- fill!: any;
12
- shape!: any;
13
- type!: any;
4
+ public lineWidth!: any;
5
+ public lineColor!: any;
6
+ public lineAlpha!: any;
7
+ public _lineTint!: any;
8
+ public fillColor!: any;
9
+ public fillAlpha!: any;
10
+ public _fillTint!: any;
11
+ public fill!: any;
12
+ public shape!: any;
13
+ public type!: any;
14
14
  /**
15
15
  * Creates a new GraphicsData object.
16
16
  * @param {number} lineWidth - The line width.
@@ -21,7 +21,7 @@ export class GraphicsData {
21
21
  * @param {boolean} fill - Whether to fill the shape.
22
22
  * @param {object} shape - The shape to draw.
23
23
  */
24
- constructor(
24
+ public constructor(
25
25
  lineWidth: number,
26
26
  lineColor: number,
27
27
  lineAlpha: number,
@@ -46,7 +46,7 @@ export class GraphicsData {
46
46
  * Clones this GraphicsData object.
47
47
  * @returns {GraphicsData} A new cloned GraphicsData object.
48
48
  */
49
- clone() {
49
+ public clone() {
50
50
  return clone(this);
51
51
  }
52
52
  }
@@ -5,8 +5,8 @@ import { GraphicsData } from './graphics_data.js';
5
5
  * @param {GraphicsData} source - The source GraphicsData to clone.
6
6
  * @returns {GraphicsData} A new cloned GraphicsData object.
7
7
  */
8
- export const clone = (source: GraphicsData) => {
9
- return new GraphicsData(
8
+ export const clone = (source: GraphicsData) =>
9
+ new GraphicsData(
10
10
  source.lineWidth,
11
11
  source.lineColor,
12
12
  source.lineAlpha,
@@ -15,4 +15,3 @@ export const clone = (source: GraphicsData) => {
15
15
  source.fill,
16
16
  source.shape
17
17
  );
18
- };