@vpmedia/phaser 1.115.0 → 1.117.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 (193) hide show
  1. package/dist/index.js +56 -96
  2. package/dist/index.js.map +1 -1
  3. package/dist/phaser/core/animation.d.ts.map +1 -1
  4. package/dist/phaser/core/animation_manager.d.ts +15 -14
  5. package/dist/phaser/core/animation_manager.d.ts.map +1 -1
  6. package/dist/phaser/core/animation_parser.d.ts.map +1 -1
  7. package/dist/phaser/core/array_set.d.ts.map +1 -1
  8. package/dist/phaser/core/cache.d.ts +10 -9
  9. package/dist/phaser/core/cache.d.ts.map +1 -1
  10. package/dist/phaser/core/device_util.d.ts.map +1 -1
  11. package/dist/phaser/core/dom.d.ts.map +1 -1
  12. package/dist/phaser/core/factory.d.ts.map +1 -1
  13. package/dist/phaser/core/game.d.ts.map +1 -1
  14. package/dist/phaser/core/input.d.ts +20 -20
  15. package/dist/phaser/core/input.d.ts.map +1 -1
  16. package/dist/phaser/core/input_handler.d.ts +11 -13
  17. package/dist/phaser/core/input_handler.d.ts.map +1 -1
  18. package/dist/phaser/core/input_mouse.d.ts.map +1 -1
  19. package/dist/phaser/core/input_mspointer.d.ts.map +1 -1
  20. package/dist/phaser/core/input_pointer.d.ts +19 -8
  21. package/dist/phaser/core/input_pointer.d.ts.map +1 -1
  22. package/dist/phaser/core/input_touch.d.ts.map +1 -1
  23. package/dist/phaser/core/loader.d.ts.map +1 -1
  24. package/dist/phaser/core/raf.d.ts.map +1 -1
  25. package/dist/phaser/core/scale_manager.d.ts +38 -13
  26. package/dist/phaser/core/scale_manager.d.ts.map +1 -1
  27. package/dist/phaser/core/scene.d.ts.map +1 -1
  28. package/dist/phaser/core/scene_manager.d.ts.map +1 -1
  29. package/dist/phaser/core/signal.d.ts.map +1 -1
  30. package/dist/phaser/core/signal_binding.d.ts.map +1 -1
  31. package/dist/phaser/core/sound.d.ts +2 -2
  32. package/dist/phaser/core/sound.d.ts.map +1 -1
  33. package/dist/phaser/core/sound_manager.d.ts +24 -22
  34. package/dist/phaser/core/sound_manager.d.ts.map +1 -1
  35. package/dist/phaser/core/sound_sprite.d.ts.map +1 -1
  36. package/dist/phaser/core/stage.d.ts.map +1 -1
  37. package/dist/phaser/core/time.d.ts.map +1 -1
  38. package/dist/phaser/core/timer.d.ts +1 -1
  39. package/dist/phaser/core/timer.d.ts.map +1 -1
  40. package/dist/phaser/core/tween.d.ts.map +1 -1
  41. package/dist/phaser/core/tween_data.d.ts +26 -26
  42. package/dist/phaser/core/tween_data.d.ts.map +1 -1
  43. package/dist/phaser/core/tween_manager.d.ts.map +1 -1
  44. package/dist/phaser/core/world.d.ts.map +1 -1
  45. package/dist/phaser/display/bitmap_text.d.ts.map +1 -1
  46. package/dist/phaser/display/button.d.ts.map +1 -1
  47. package/dist/phaser/display/canvas/buffer.d.ts.map +1 -1
  48. package/dist/phaser/display/canvas/graphics.d.ts.map +1 -1
  49. package/dist/phaser/display/canvas/masker.d.ts.map +1 -1
  50. package/dist/phaser/display/canvas/pool.d.ts.map +1 -1
  51. package/dist/phaser/display/canvas/renderer.d.ts.map +1 -1
  52. package/dist/phaser/display/canvas/tinter.d.ts +3 -2
  53. package/dist/phaser/display/canvas/tinter.d.ts.map +1 -1
  54. package/dist/phaser/display/canvas/util.d.ts.map +1 -1
  55. package/dist/phaser/display/display_object.d.ts.map +1 -1
  56. package/dist/phaser/display/graphics.d.ts.map +1 -1
  57. package/dist/phaser/display/graphics_data.d.ts.map +1 -1
  58. package/dist/phaser/display/graphics_data_util.d.ts.map +1 -1
  59. package/dist/phaser/display/group.d.ts.map +1 -1
  60. package/dist/phaser/display/image.d.ts +2 -2
  61. package/dist/phaser/display/image.d.ts.map +1 -1
  62. package/dist/phaser/display/sprite_util.d.ts.map +1 -1
  63. package/dist/phaser/display/text.d.ts.map +1 -1
  64. package/dist/phaser/display/webgl/abstract_filter.d.ts.map +1 -1
  65. package/dist/phaser/display/webgl/base_texture.d.ts +12 -10
  66. package/dist/phaser/display/webgl/base_texture.d.ts.map +1 -1
  67. package/dist/phaser/display/webgl/blend_manager.d.ts.map +1 -1
  68. package/dist/phaser/display/webgl/earcut.d.ts.map +1 -1
  69. package/dist/phaser/display/webgl/fast_sprite_batch.d.ts +13 -12
  70. package/dist/phaser/display/webgl/fast_sprite_batch.d.ts.map +1 -1
  71. package/dist/phaser/display/webgl/filter_manager.d.ts.map +1 -1
  72. package/dist/phaser/display/webgl/filter_texture.d.ts.map +1 -1
  73. package/dist/phaser/display/webgl/graphics.d.ts +9 -7
  74. package/dist/phaser/display/webgl/graphics.d.ts.map +1 -1
  75. package/dist/phaser/display/webgl/graphics_data.d.ts.map +1 -1
  76. package/dist/phaser/display/webgl/mask_manager.d.ts.map +1 -1
  77. package/dist/phaser/display/webgl/render_texture.d.ts.map +1 -1
  78. package/dist/phaser/display/webgl/renderer.d.ts +12 -10
  79. package/dist/phaser/display/webgl/renderer.d.ts.map +1 -1
  80. package/dist/phaser/display/webgl/shader/normal.d.ts.map +1 -1
  81. package/dist/phaser/display/webgl/shader_manager.d.ts.map +1 -1
  82. package/dist/phaser/display/webgl/sprite_batch.d.ts.map +1 -1
  83. package/dist/phaser/display/webgl/stencil_manager.d.ts.map +1 -1
  84. package/dist/phaser/display/webgl/texture.d.ts +18 -33
  85. package/dist/phaser/display/webgl/texture.d.ts.map +1 -1
  86. package/dist/phaser/display/webgl/texture_util.d.ts.map +1 -1
  87. package/dist/phaser/display/webgl/util.d.ts.map +1 -1
  88. package/dist/phaser/geom/circle.d.ts.map +1 -1
  89. package/dist/phaser/geom/ellipse.d.ts.map +1 -1
  90. package/dist/phaser/geom/line.d.ts.map +1 -1
  91. package/dist/phaser/geom/matrix.d.ts +1 -1
  92. package/dist/phaser/geom/matrix.d.ts.map +1 -1
  93. package/dist/phaser/geom/point.d.ts.map +1 -1
  94. package/dist/phaser/geom/polygon.d.ts.map +1 -1
  95. package/dist/phaser/geom/rectangle.d.ts.map +1 -1
  96. package/dist/phaser/geom/rounded_rectangle.d.ts.map +1 -1
  97. package/dist/phaser/geom/util/circle.d.ts.map +1 -1
  98. package/dist/phaser/geom/util/ellipse.d.ts.map +1 -1
  99. package/dist/phaser/geom/util/line.d.ts +5 -4
  100. package/dist/phaser/geom/util/line.d.ts.map +1 -1
  101. package/dist/phaser/geom/util/matrix.d.ts.map +1 -1
  102. package/dist/phaser/geom/util/point.d.ts.map +1 -1
  103. package/dist/phaser/geom/util/polygon.d.ts.map +1 -1
  104. package/dist/phaser/geom/util/rectangle.d.ts +10 -1
  105. package/dist/phaser/geom/util/rectangle.d.ts.map +1 -1
  106. package/dist/phaser/geom/util/rounded_rectangle.d.ts.map +1 -1
  107. package/package.json +1 -1
  108. package/src/phaser/core/animation.ts +20 -20
  109. package/src/phaser/core/animation_manager.ts +27 -24
  110. package/src/phaser/core/animation_parser.ts +2 -2
  111. package/src/phaser/core/array_set.ts +7 -7
  112. package/src/phaser/core/cache.ts +55 -51
  113. package/src/phaser/core/callback_context.test.ts +70 -0
  114. package/src/phaser/core/device_util.ts +13 -13
  115. package/src/phaser/core/dom.ts +26 -22
  116. package/src/phaser/core/factory.ts +6 -6
  117. package/src/phaser/core/game.ts +10 -10
  118. package/src/phaser/core/input.ts +37 -39
  119. package/src/phaser/core/input_handler.ts +90 -93
  120. package/src/phaser/core/input_mouse.ts +19 -19
  121. package/src/phaser/core/input_mspointer.ts +15 -15
  122. package/src/phaser/core/input_pointer.ts +37 -28
  123. package/src/phaser/core/input_touch.ts +17 -17
  124. package/src/phaser/core/loader.ts +52 -52
  125. package/src/phaser/core/loader_parser.ts +3 -3
  126. package/src/phaser/core/raf.ts +3 -3
  127. package/src/phaser/core/scale_manager.ts +86 -67
  128. package/src/phaser/core/scene.ts +7 -7
  129. package/src/phaser/core/scene_manager.ts +16 -16
  130. package/src/phaser/core/signal.ts +29 -19
  131. package/src/phaser/core/signal_binding.ts +4 -4
  132. package/src/phaser/core/sound.ts +17 -17
  133. package/src/phaser/core/sound_manager.ts +71 -72
  134. package/src/phaser/core/sound_sprite.ts +1 -1
  135. package/src/phaser/core/stage.ts +7 -7
  136. package/src/phaser/core/time.ts +16 -16
  137. package/src/phaser/core/timer.ts +36 -26
  138. package/src/phaser/core/tween.ts +23 -23
  139. package/src/phaser/core/tween_data.ts +41 -37
  140. package/src/phaser/core/tween_manager.ts +11 -11
  141. package/src/phaser/core/world.ts +1 -1
  142. package/src/phaser/display/bitmap_text.ts +13 -13
  143. package/src/phaser/display/button.ts +13 -13
  144. package/src/phaser/display/canvas/buffer.ts +3 -3
  145. package/src/phaser/display/canvas/graphics.ts +3 -3
  146. package/src/phaser/display/canvas/masker.ts +2 -2
  147. package/src/phaser/display/canvas/pool.ts +6 -6
  148. package/src/phaser/display/canvas/renderer.ts +6 -6
  149. package/src/phaser/display/canvas/tinter.ts +39 -8
  150. package/src/phaser/display/canvas/util.ts +15 -9
  151. package/src/phaser/display/display_object.ts +38 -38
  152. package/src/phaser/display/graphics.ts +30 -30
  153. package/src/phaser/display/graphics_data.ts +1 -1
  154. package/src/phaser/display/graphics_data_util.ts +1 -1
  155. package/src/phaser/display/group.ts +16 -16
  156. package/src/phaser/display/image.ts +30 -26
  157. package/src/phaser/display/sprite_util.ts +12 -4
  158. package/src/phaser/display/text.ts +55 -55
  159. package/src/phaser/display/webgl/abstract_filter.ts +1 -1
  160. package/src/phaser/display/webgl/base_texture.ts +22 -18
  161. package/src/phaser/display/webgl/blend_manager.ts +3 -3
  162. package/src/phaser/display/webgl/earcut.ts +3 -3
  163. package/src/phaser/display/webgl/fast_sprite_batch.ts +26 -24
  164. package/src/phaser/display/webgl/filter_manager.ts +7 -7
  165. package/src/phaser/display/webgl/filter_texture.ts +3 -3
  166. package/src/phaser/display/webgl/graphics.ts +43 -41
  167. package/src/phaser/display/webgl/graphics_data.ts +2 -2
  168. package/src/phaser/display/webgl/mask_manager.ts +2 -2
  169. package/src/phaser/display/webgl/render_texture.ts +6 -6
  170. package/src/phaser/display/webgl/renderer.ts +20 -25
  171. package/src/phaser/display/webgl/shader/normal.ts +3 -3
  172. package/src/phaser/display/webgl/shader_manager.ts +2 -2
  173. package/src/phaser/display/webgl/sprite_batch.ts +9 -9
  174. package/src/phaser/display/webgl/stencil_manager.ts +4 -4
  175. package/src/phaser/display/webgl/texture.ts +23 -42
  176. package/src/phaser/display/webgl/texture_util.ts +2 -2
  177. package/src/phaser/display/webgl/util.ts +11 -7
  178. package/src/phaser/geom/circle.ts +21 -21
  179. package/src/phaser/geom/ellipse.ts +7 -7
  180. package/src/phaser/geom/line.ts +29 -29
  181. package/src/phaser/geom/matrix.ts +13 -13
  182. package/src/phaser/geom/point.ts +36 -30
  183. package/src/phaser/geom/polygon.ts +6 -6
  184. package/src/phaser/geom/rectangle.ts +42 -42
  185. package/src/phaser/geom/rounded_rectangle.ts +2 -2
  186. package/src/phaser/geom/util/circle.ts +7 -7
  187. package/src/phaser/geom/util/ellipse.ts +1 -1
  188. package/src/phaser/geom/util/line.ts +13 -5
  189. package/src/phaser/geom/util/matrix.ts +3 -3
  190. package/src/phaser/geom/util/point.ts +20 -20
  191. package/src/phaser/geom/util/polygon.ts +1 -1
  192. package/src/phaser/geom/util/rectangle.ts +34 -17
  193. package/src/phaser/geom/util/rounded_rectangle.ts +1 -1
@@ -74,7 +74,7 @@ export class Group extends DisplayObject {
74
74
  * @param {boolean} destroyChildren - Whether to destroy children as well.
75
75
  * @param {boolean} soft - Whether to perform a soft destroy (leaving the group in the parent's children list).
76
76
  */
77
- public override destroy(destroyChildren = true, soft = false) {
77
+ public override destroy(destroyChildren = true, soft = false): void {
78
78
  if (this.game === null || this.ignoreDestroy) {
79
79
  return;
80
80
  }
@@ -128,7 +128,7 @@ export class Group extends DisplayObject {
128
128
  * @param {number} index - The index to add the child at.
129
129
  * @param {boolean} silent - Whether to dispatch events.
130
130
  */
131
- public addAt(child: DisplayObject, index: number, silent: boolean) {
131
+ public addAt(child: DisplayObject, index: number, silent: boolean): void {
132
132
  this.add(child, silent, index);
133
133
  }
134
134
 
@@ -137,7 +137,7 @@ export class Group extends DisplayObject {
137
137
  * @param {number} index - The index of the child to get.
138
138
  * @returns {DisplayObject} The child at the specified index, or -1 if not found.
139
139
  */
140
- public getAt(index: number) {
140
+ public getAt(index: number): -1 | DisplayObject | undefined {
141
141
  if (index < 0 || index >= this.children.length) {
142
142
  return -1;
143
143
  }
@@ -147,7 +147,7 @@ export class Group extends DisplayObject {
147
147
  /**
148
148
  * Updates the Z indices of all children in this group.
149
149
  */
150
- public updateZ() {
150
+ public updateZ(): void {
151
151
  let i = this.children.length;
152
152
  while (i) {
153
153
  i -= 1;
@@ -159,7 +159,7 @@ export class Group extends DisplayObject {
159
159
  * Gets the next child in this group (with circular wrapping).
160
160
  * @returns {DisplayObject} The next child, or null if no children exist.
161
161
  */
162
- public next() {
162
+ public next(): DisplayObject | null {
163
163
  if (this.cursor) {
164
164
  // Wrap the cursor?
165
165
  if (this.cursorIndex >= this.children.length - 1) {
@@ -177,7 +177,7 @@ export class Group extends DisplayObject {
177
177
  * Gets the previous child in this group (with circular wrapping).
178
178
  * @returns {DisplayObject} The previous child, or null if no children exist.
179
179
  */
180
- public previous() {
180
+ public previous(): DisplayObject | null {
181
181
  if (this.cursor) {
182
182
  // Wrap the cursor?
183
183
  if (this.cursorIndex === 0) {
@@ -196,7 +196,7 @@ export class Group extends DisplayObject {
196
196
  * @param {DisplayObject} child1 - The first child to swap.
197
197
  * @param {DisplayObject} child2 - The second child to swap.
198
198
  */
199
- public swap(child1: DisplayObject, child2: DisplayObject) {
199
+ public swap(child1: DisplayObject, child2: DisplayObject): void {
200
200
  this.swapChildren(child1, child2);
201
201
  this.updateZ();
202
202
  }
@@ -206,7 +206,7 @@ export class Group extends DisplayObject {
206
206
  * @param {DisplayObject} child - The child to bring to the top.
207
207
  * @returns {DisplayObject} The child that was brought to the top.
208
208
  */
209
- public bringToTop(child: DisplayObject) {
209
+ public bringToTop(child: DisplayObject): DisplayObject {
210
210
  if (child.parent === this && this.getIndex(child) < this.children.length) {
211
211
  this.remove(child, false, true);
212
212
  this.add(child, true);
@@ -219,7 +219,7 @@ export class Group extends DisplayObject {
219
219
  * @param {DisplayObject} child - The child to send to the back.
220
220
  * @returns {DisplayObject} The child that was sent to the back.
221
221
  */
222
- public sendToBack(child: DisplayObject) {
222
+ public sendToBack(child: DisplayObject): DisplayObject {
223
223
  if (child.parent === this && this.getIndex(child) > 0) {
224
224
  this.remove(child, false, true);
225
225
  this.addAt(child, 0, true);
@@ -230,7 +230,7 @@ export class Group extends DisplayObject {
230
230
  /**
231
231
  * Reverses the order of children in this group.
232
232
  */
233
- public reverse() {
233
+ public reverse(): void {
234
234
  this.children.reverse();
235
235
  this.updateZ();
236
236
  }
@@ -240,14 +240,14 @@ export class Group extends DisplayObject {
240
240
  * @param {DisplayObject} child - The child to get the index of.
241
241
  * @returns {number} The index of the child, or -1 if not found.
242
242
  */
243
- public getIndex(child: DisplayObject) {
243
+ public getIndex(child: DisplayObject): number {
244
244
  return this.children.indexOf(child);
245
245
  }
246
246
 
247
247
  /**
248
248
  * Updates the Z indices of all children in this group before the update cycle.
249
249
  */
250
- public override preUpdate() {
250
+ public override preUpdate(): void {
251
251
  if (this.pendingDestroy) {
252
252
  this.destroy();
253
253
  return;
@@ -264,7 +264,7 @@ export class Group extends DisplayObject {
264
264
  /**
265
265
  * Updates all children in this group during the update cycle.
266
266
  */
267
- public override update() {
267
+ public override update(): void {
268
268
  let i = this.children.length;
269
269
  while (i) {
270
270
  i -= 1;
@@ -275,7 +275,7 @@ export class Group extends DisplayObject {
275
275
  /**
276
276
  * Updates all children in this group after the update cycle.
277
277
  */
278
- public override postUpdate() {
278
+ public override postUpdate(): void {
279
279
  for (const child of this.children) {
280
280
  child.postUpdate();
281
281
  }
@@ -288,7 +288,7 @@ export class Group extends DisplayObject {
288
288
  * @param {boolean} silent - Whether to dispatch events.
289
289
  * @returns {boolean} True if the child was removed, false otherwise.
290
290
  */
291
- public remove(child: any, destroy = true, silent = false) {
291
+ public remove(child: any, destroy = true, silent = false): boolean {
292
292
  if (this.children.length === 0 || !this.children.includes(child)) {
293
293
  return false;
294
294
  }
@@ -312,7 +312,7 @@ export class Group extends DisplayObject {
312
312
  * @param {boolean} silent - Whether to dispatch events.
313
313
  * @param {boolean} destroyTexture - Whether to destroy textures as well.
314
314
  */
315
- public removeAll(destroy = true, silent = false, destroyTexture = false) {
315
+ public removeAll(destroy = true, silent = false, destroyTexture = false): void {
316
316
  if (this.children.length === 0) {
317
317
  return;
318
318
  }
@@ -88,7 +88,7 @@ export class Image extends DisplayObject {
88
88
  /**
89
89
  * Destroys this image and cleans up resources.
90
90
  */
91
- public override destroy() {
91
+ public override destroy(): void {
92
92
  this.game = null!;
93
93
  this.key = null;
94
94
  this.data = null;
@@ -112,7 +112,7 @@ export class Image extends DisplayObject {
112
112
  /**
113
113
  * Called before the update cycle for this image.
114
114
  */
115
- public override preUpdate() {
115
+ public override preUpdate(): void {
116
116
  if (this.pendingDestroy) {
117
117
  this.destroy();
118
118
  return;
@@ -141,7 +141,11 @@ export class Image extends DisplayObject {
141
141
  * @param {string | number | null | undefined} frame - The frame identifier (name or index) to use.
142
142
  * @param {boolean} stopAnimation - Whether to stop the animation when changing textures.
143
143
  */
144
- public loadTexture(key: string | number | Texture | null, frame: string | number | null = 0, stopAnimation = true) {
144
+ public loadTexture(
145
+ key: string | number | Texture | null,
146
+ frame: string | number | null = 0,
147
+ stopAnimation = true
148
+ ): void {
145
149
  if (key === PENDING_ATLAS) {
146
150
  key = frame ?? 0;
147
151
  frame = 0;
@@ -159,7 +163,7 @@ export class Image extends DisplayObject {
159
163
  if (key instanceof Texture) {
160
164
  this.setTexture(key);
161
165
  } else {
162
- const img = cache.getImage(key, true);
166
+ const img = cache.getImage(key ?? undefined, true);
163
167
  if (img) {
164
168
  this.key = img.key;
165
169
  this.setTexture(new Texture(img.base));
@@ -183,7 +187,7 @@ export class Image extends DisplayObject {
183
187
  * Sets the current frame of this image.
184
188
  * @param {Frame} frame - The frame to set.
185
189
  */
186
- public setFrame(frame: Frame) {
190
+ public setFrame(frame: Frame): void {
187
191
  this._frame = frame;
188
192
  this.texture.frame.x = frame.x;
189
193
  this.texture.frame.y = frame.y;
@@ -200,12 +204,12 @@ export class Image extends DisplayObject {
200
204
  this.texture.trim.width = frame.sourceSizeW;
201
205
  this.texture.trim.height = frame.sourceSizeH;
202
206
  } else {
203
- this.texture.trim = {
204
- x: frame.spriteSourceSizeX,
205
- y: frame.spriteSourceSizeY,
206
- width: frame.sourceSizeW,
207
- height: frame.sourceSizeH,
208
- };
207
+ this.texture.trim = new Rectangle(
208
+ frame.spriteSourceSizeX,
209
+ frame.spriteSourceSizeY,
210
+ frame.sourceSizeW,
211
+ frame.sourceSizeH
212
+ );
209
213
  }
210
214
  this.texture.width = frame.sourceSizeW;
211
215
  this.texture.height = frame.sourceSizeH;
@@ -230,7 +234,7 @@ export class Image extends DisplayObject {
230
234
  * @param {number} width - The new width of the frame.
231
235
  * @param {number} height - The new height of the frame.
232
236
  */
233
- public resizeFrame(_parent: DisplayObject, width: number, height: number) {
237
+ public resizeFrame(_parent: DisplayObject, width: number, height: number): void {
234
238
  this.texture.frame.resize(width, height);
235
239
  this.texture.setFrame(this.texture.frame);
236
240
  }
@@ -238,7 +242,7 @@ export class Image extends DisplayObject {
238
242
  /**
239
243
  * Resets the frame of this image to its original frame.
240
244
  */
241
- public resetFrame() {
245
+ public resetFrame(): void {
242
246
  if (this._frame) {
243
247
  this.setFrame(this._frame);
244
248
  }
@@ -248,7 +252,7 @@ export class Image extends DisplayObject {
248
252
  * Gets the current frame index of this image.
249
253
  * @returns {number} The current frame index.
250
254
  */
251
- public get frame() {
255
+ public get frame(): number {
252
256
  return this.animations.frame;
253
257
  }
254
258
 
@@ -264,7 +268,7 @@ export class Image extends DisplayObject {
264
268
  * Gets the current frame name of this image.
265
269
  * @returns {string} The current frame name.
266
270
  */
267
- public get frameName() {
271
+ public get frameName(): string | null {
268
272
  return this.animations.frameName;
269
273
  }
270
274
 
@@ -272,7 +276,7 @@ export class Image extends DisplayObject {
272
276
  * Sets the current frame name of this image.
273
277
  * @param {string} value - The new frame name to set.
274
278
  */
275
- public set frameName(value: string) {
279
+ public set frameName(value: string | null) {
276
280
  this.animations.frameName = value;
277
281
  }
278
282
 
@@ -283,7 +287,7 @@ export class Image extends DisplayObject {
283
287
  * @param {Rectangle} rect - The rectangle to crop to.
284
288
  * @param {boolean} copy - Whether to copy the rect or use it directly.
285
289
  */
286
- public crop(rect: Rectangle, copy = false) {
290
+ public crop(rect: Rectangle, copy = false): void {
287
291
  if (rect) {
288
292
  if (copy && this.cropRect !== null) {
289
293
  this.cropRect.setTo(rect.x, rect.y, rect.width, rect.height);
@@ -303,7 +307,7 @@ export class Image extends DisplayObject {
303
307
  /**
304
308
  * Updates the crop rectangle of this image.
305
309
  */
306
- public updateCrop() {
310
+ public updateCrop(): void {
307
311
  if (!this.cropRect) {
308
312
  return;
309
313
  }
@@ -336,7 +340,7 @@ export class Image extends DisplayObject {
336
340
  * Gets the width of this image.
337
341
  * @returns {number} The width in pixels.
338
342
  */
339
- public override get width() {
343
+ public override get width(): number {
340
344
  return this.scale.x * this.texture.frame.width;
341
345
  }
342
346
 
@@ -353,7 +357,7 @@ export class Image extends DisplayObject {
353
357
  * Gets the height of this image.
354
358
  * @returns {number} The height in pixels.
355
359
  */
356
- public override get height() {
360
+ public override get height(): number {
357
361
  return this.scale.y * this.texture.frame.height;
358
362
  }
359
363
 
@@ -369,7 +373,7 @@ export class Image extends DisplayObject {
369
373
  /**
370
374
  * Called when the texture of this image is updated.
371
375
  */
372
- public onTextureUpdate() {
376
+ public onTextureUpdate(): void {
373
377
  // So if _width is 0 then width was not set..
374
378
  if (this._width) {
375
379
  this.scale.x = this._width / this.texture.frame.width;
@@ -384,7 +388,7 @@ export class Image extends DisplayObject {
384
388
  * @param {Texture} texture - The new texture to set.
385
389
  * @param {boolean} destroyBase - Whether to destroy the base texture.
386
390
  */
387
- public setTexture(texture: Texture, destroyBase = false) {
391
+ public setTexture(texture: Texture, destroyBase = false): void {
388
392
  setTexture(this, texture, destroyBase);
389
393
  }
390
394
 
@@ -393,7 +397,7 @@ export class Image extends DisplayObject {
393
397
  * @param {Matrix} matrix - The transformation matrix to use.
394
398
  * @returns {Rectangle} The bounds rectangle of this image.
395
399
  */
396
- public override getBounds(matrix: Matrix | null = null) {
400
+ public override getBounds(matrix: Matrix | null = null): Rectangle {
397
401
  return getBounds(this, matrix);
398
402
  }
399
403
 
@@ -401,7 +405,7 @@ export class Image extends DisplayObject {
401
405
  * Gets the local bounds of this image.
402
406
  * @returns {Rectangle} The local bounds rectangle of this image.
403
407
  */
404
- public override getLocalBounds() {
408
+ public override getLocalBounds(): Rectangle {
405
409
  return getLocalBounds(this);
406
410
  }
407
411
 
@@ -410,7 +414,7 @@ export class Image extends DisplayObject {
410
414
  * @param {object} renderSession - The WebGL rendering session.
411
415
  * @param {Matrix} matrix - The transformation matrix to use.
412
416
  */
413
- public override renderWebGL(renderSession: RenderSession, matrix: Matrix | null = null) {
417
+ public override renderWebGL(renderSession: RenderSession, matrix: Matrix | null = null): void {
414
418
  renderWebGL(this, renderSession, matrix);
415
419
  }
416
420
 
@@ -419,7 +423,7 @@ export class Image extends DisplayObject {
419
423
  * @param {object} renderSession - The Canvas rendering session.
420
424
  * @param {Matrix} matrix - The transformation matrix to use.
421
425
  */
422
- public override renderCanvas(renderSession: RenderSession, matrix: Matrix | null = null) {
426
+ public override renderCanvas(renderSession: RenderSession, matrix: Matrix | null = null): void {
423
427
  renderCanvas(this, renderSession, matrix);
424
428
  }
425
429
  }
@@ -13,7 +13,7 @@ import { setSmoothing } from './canvas/util.js';
13
13
  * @param {Texture} texture - The new texture to set.
14
14
  * @param {boolean} destroyBase - Whether to destroy the base texture.
15
15
  */
16
- export const setTexture = (target: Image, texture: Texture, destroyBase = false) => {
16
+ export const setTexture = (target: Image, texture: Texture, destroyBase = false): void => {
17
17
  if (destroyBase) {
18
18
  target.texture.baseTexture.destroy();
19
19
  }
@@ -131,7 +131,11 @@ export const getLocalBounds = (target: Image) => {
131
131
  * @param {object} renderSession - The render session object.
132
132
  * @param {Matrix | null | undefined} matrix - The transformation matrix.
133
133
  */
134
- export const renderWebGL = (target: Image, renderSession: RenderSession, matrix: Matrix | null | undefined = null) => {
134
+ export const renderWebGL = (
135
+ target: Image,
136
+ renderSession: RenderSession,
137
+ matrix: Matrix | null | undefined = null
138
+ ): void => {
135
139
  // if the sprite is not visible or the alpha is 0 then no need to render this element
136
140
  if (!target.visible || target.alpha <= 0 || !target.renderable) {
137
141
  return;
@@ -184,7 +188,11 @@ export const renderWebGL = (target: Image, renderSession: RenderSession, matrix:
184
188
  * @param {object} renderSession - The render session object.
185
189
  * @param {Matrix | null | undefined} matrix - The transformation matrix.
186
190
  */
187
- export const renderCanvas = (target: Image, renderSession: RenderSession, matrix: Matrix | null | undefined = null) => {
191
+ export const renderCanvas = (
192
+ target: Image,
193
+ renderSession: RenderSession,
194
+ matrix: Matrix | null | undefined = null
195
+ ): void => {
188
196
  // If the sprite is not visible or the alpha is 0 then no need to render this element
189
197
  if (
190
198
  !target.visible ||
@@ -253,7 +261,7 @@ export const renderCanvas = (target: Image, renderSession: RenderSession, matrix
253
261
  cw = Math.floor(cw);
254
262
  ch = Math.floor(ch);
255
263
  renderSession.context.drawImage(
256
- target.texture.baseTexture.source,
264
+ target.texture.baseTexture.source!,
257
265
  cx,
258
266
  cy,
259
267
  cw,