@vpmedia/phaser 1.124.0 → 1.125.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 (76) hide show
  1. package/dist/index.js +305 -309
  2. package/dist/index.js.map +1 -1
  3. package/dist/phaser/core/animation_parser.d.ts.map +1 -1
  4. package/dist/phaser/core/dom.d.ts.map +1 -1
  5. package/dist/phaser/core/frame_data.d.ts.map +1 -1
  6. package/dist/phaser/core/loader.d.ts.map +1 -1
  7. package/dist/phaser/core/scale_manager.d.ts.map +1 -1
  8. package/dist/phaser/core/sound.d.ts.map +1 -1
  9. package/dist/phaser/core/sound_manager.d.ts.map +1 -1
  10. package/dist/phaser/core/tween.d.ts.map +1 -1
  11. package/dist/phaser/display/canvas/renderer.d.ts.map +1 -1
  12. package/dist/phaser/display/display_object.d.ts +2 -2
  13. package/dist/phaser/display/display_object.d.ts.map +1 -1
  14. package/dist/phaser/display/graphics.d.ts +1 -1
  15. package/dist/phaser/display/graphics.d.ts.map +1 -1
  16. package/dist/phaser/display/group.d.ts.map +1 -1
  17. package/dist/phaser/display/image.d.ts.map +1 -1
  18. package/dist/phaser/display/text.d.ts.map +1 -1
  19. package/dist/phaser/display/webgl/earcut.d.ts.map +1 -1
  20. package/dist/phaser/display/webgl/texture.d.ts.map +1 -1
  21. package/dist/phaser/geom/rectangle.d.ts.map +1 -1
  22. package/dist/phaser/geom/util/circle.d.ts.map +1 -1
  23. package/dist/phaser/geom/util/point.d.ts.map +1 -1
  24. package/dist/phaser/util/math.d.ts.map +1 -1
  25. package/package.json +1 -1
  26. package/src/phaser/core/animation.ts +7 -7
  27. package/src/phaser/core/animation_manager.ts +2 -2
  28. package/src/phaser/core/animation_parser.ts +11 -15
  29. package/src/phaser/core/array_set.ts +2 -2
  30. package/src/phaser/core/cache.ts +4 -4
  31. package/src/phaser/core/device_util.ts +4 -4
  32. package/src/phaser/core/dom.ts +23 -19
  33. package/src/phaser/core/frame_data.ts +2 -5
  34. package/src/phaser/core/game.ts +12 -12
  35. package/src/phaser/core/input.ts +2 -2
  36. package/src/phaser/core/input_handler.ts +13 -13
  37. package/src/phaser/core/input_mouse.ts +4 -4
  38. package/src/phaser/core/input_pointer.ts +1 -1
  39. package/src/phaser/core/loader.ts +38 -50
  40. package/src/phaser/core/scale_manager.ts +10 -9
  41. package/src/phaser/core/scene_manager.ts +2 -2
  42. package/src/phaser/core/signal.ts +2 -2
  43. package/src/phaser/core/sound.ts +25 -32
  44. package/src/phaser/core/sound_manager.ts +12 -16
  45. package/src/phaser/core/sound_sprite.ts +1 -1
  46. package/src/phaser/core/stage.ts +3 -3
  47. package/src/phaser/core/timer.ts +1 -1
  48. package/src/phaser/core/tween.ts +6 -11
  49. package/src/phaser/display/bitmap_text.ts +3 -3
  50. package/src/phaser/display/button.ts +12 -12
  51. package/src/phaser/display/canvas/graphics.ts +2 -2
  52. package/src/phaser/display/canvas/pool.ts +3 -3
  53. package/src/phaser/display/canvas/renderer.ts +6 -5
  54. package/src/phaser/display/canvas/tinter.ts +1 -1
  55. package/src/phaser/display/canvas/util.ts +2 -2
  56. package/src/phaser/display/display_object.ts +13 -14
  57. package/src/phaser/display/graphics.test.ts +2 -2
  58. package/src/phaser/display/graphics.ts +9 -11
  59. package/src/phaser/display/group.ts +10 -9
  60. package/src/phaser/display/image.ts +7 -6
  61. package/src/phaser/display/sprite_util.ts +1 -1
  62. package/src/phaser/display/text.ts +35 -44
  63. package/src/phaser/display/webgl/abstract_filter.ts +1 -1
  64. package/src/phaser/display/webgl/earcut.ts +46 -42
  65. package/src/phaser/display/webgl/graphics.ts +1 -1
  66. package/src/phaser/display/webgl/renderer.ts +3 -3
  67. package/src/phaser/display/webgl/shader/normal.ts +6 -6
  68. package/src/phaser/display/webgl/shader_manager.ts +1 -1
  69. package/src/phaser/display/webgl/sprite_batch.ts +2 -2
  70. package/src/phaser/display/webgl/texture.ts +2 -1
  71. package/src/phaser/display/webgl/util.ts +3 -3
  72. package/src/phaser/geom/polygon.ts +2 -2
  73. package/src/phaser/geom/rectangle.ts +1 -2
  74. package/src/phaser/geom/util/circle.ts +6 -10
  75. package/src/phaser/geom/util/point.ts +5 -7
  76. package/src/phaser/util/math.ts +2 -3
@@ -5,6 +5,7 @@ import type { Game, GameConfig } from './game.js';
5
5
  import { DOM } from './dom.js';
6
6
  import { Signal } from './signal.js';
7
7
  import type { AppliedCallback, Callback } from './callback.js';
8
+ import type { Input } from './input.js';
8
9
 
9
10
  /** The gap the canvas leaves around itself inside its parent. */
10
11
  export type ScaleMargin = { left: number; top: number; right: number; bottom: number; x: number; y: number };
@@ -159,7 +160,7 @@ export class ScaleManager {
159
160
  this._lastReportedCanvasSize = new Rectangle();
160
161
  this._lastReportedGameSize = new Rectangle();
161
162
  this._booted = false;
162
- if (game.config) {
163
+ if (game.config as GameConfig | undefined) {
163
164
  this.parseConfig(game.config);
164
165
  }
165
166
  this.setupScale(width, height);
@@ -249,7 +250,7 @@ export class ScaleManager {
249
250
  if (typeof this.game.parent === 'string') {
250
251
  // hopefully an element ID
251
252
  target = document.querySelector<HTMLElement>(`#${CSS.escape(this.game.parent)}`);
252
- } else if (this.game.parent && this.game.parent.nodeType === 1) {
253
+ } else if (typeof this.game.parent === 'object' && this.game.parent.nodeType === 1) {
253
254
  // quick test for a HTMLelement
254
255
  target = this.game.parent;
255
256
  }
@@ -447,12 +448,12 @@ export class ScaleManager {
447
448
  this.scaleFactorInversed.y = this.height / this.game.height;
448
449
  this.aspectRatio = this.width / this.height;
449
450
  // This can be invoked in boot pre-canvas
450
- if (this.game.canvas) {
451
+ if (this.game.canvas as HTMLCanvasElement | undefined) {
451
452
  this.dom.getOffset(this.game.canvas, this.offset);
452
453
  }
453
454
  this.bounds.setTo(this.offset.x, this.offset.y, this.width, this.height);
454
455
  // Can be invoked in boot pre-input
455
- if (this.game.input && this.game.input.scale) {
456
+ if (this.game.input as Input | undefined) {
456
457
  this.game.input.scale.setTo(this.scaleFactor.x, this.scaleFactor.y);
457
458
  }
458
459
  }
@@ -579,7 +580,7 @@ export class ScaleManager {
579
580
  * @returns {Rectangle} TBD.
580
581
  */
581
582
  public getParentBounds(target: Rectangle): Rectangle {
582
- const bounds = target || new Rectangle();
583
+ const bounds = target ?? new Rectangle();
583
584
  const parentNode = this.boundingParent;
584
585
  const { visualBounds } = this.dom;
585
586
  const { layoutBounds } = this.dom;
@@ -757,10 +758,10 @@ export class ScaleManager {
757
758
  // Max/min not honored fullscreen
758
759
  return;
759
760
  }
760
- if (this.maxWidth) {
761
+ if (this.maxWidth !== null) {
761
762
  this.width = Math.min(this.width, this.maxWidth);
762
763
  }
763
- if (this.maxHeight) {
764
+ if (this.maxHeight !== null) {
764
765
  this.height = Math.min(this.height, this.maxHeight);
765
766
  }
766
767
  }
@@ -796,7 +797,7 @@ export class ScaleManager {
796
797
  }
797
798
  if (this.compatibility.clickTrampoline === 'when-not-mouse') {
798
799
  const { input } = this.game;
799
- if (input.activePointer && input.activePointer !== input.mousePointer && allowTrampoline) {
800
+ if (input.activePointer !== null && input.activePointer !== input.mousePointer && allowTrampoline) {
800
801
  input.activePointer.addClickTrampoline('startFullScreen', this.startFullScreen, this, [antialias, false]);
801
802
  return false;
802
803
  }
@@ -953,7 +954,7 @@ export class ScaleManager {
953
954
  if (this.parentIsWindow || (this.isFullScreen && this.hasPhaserSetFullScreen && !this._createdFullScreenTarget)) {
954
955
  return null;
955
956
  }
956
- const parentNode = this.game.canvas ? (this.game.canvas.parentNode as HTMLElement | null) : null;
957
+ const parentNode = (this.game.canvas.parentNode as HTMLElement | null) ?? null;
957
958
  return parentNode ?? null;
958
959
  }
959
960
 
@@ -137,7 +137,7 @@ export class SceneManager {
137
137
  this._pendingState = key;
138
138
  this._clearWorld = clearWorld;
139
139
  this._clearCache = clearCache;
140
- if (args && args.length > 0) {
140
+ if (args.length > 0) {
141
141
  this._args = [...args];
142
142
  }
143
143
  }
@@ -153,7 +153,7 @@ export class SceneManager {
153
153
  this._pendingState = this.current;
154
154
  this._clearWorld = clearWorld;
155
155
  this._clearCache = clearCache;
156
- if (args && args.length > 0) {
156
+ if (args.length > 0) {
157
157
  this._args = [...args];
158
158
  }
159
159
  }
@@ -185,7 +185,7 @@ export class Signal {
185
185
  let n = this._bindings.length;
186
186
  while (n) {
187
187
  n -= 1;
188
- if (context) {
188
+ if (context !== null) {
189
189
  if (this._bindings[n]!.context === context) {
190
190
  this._bindings[n]!._destroy();
191
191
  this._bindings.splice(n, 1);
@@ -194,7 +194,7 @@ export class Signal {
194
194
  this._bindings[n]!._destroy();
195
195
  }
196
196
  }
197
- if (!context) {
197
+ if (context === null) {
198
198
  this._bindings.length = 0;
199
199
  }
200
200
  }
@@ -81,7 +81,7 @@ export class Sound {
81
81
  */
82
82
  public constructor(game: Game, key: string, volume = 1, loop = false, connect: boolean | null = null) {
83
83
  // https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API/Migrating_from_webkitAudioContext
84
- connect ??= game.sound.connectToMaster;
84
+ const connectToMaster = connect ?? game.sound.connectToMaster;
85
85
  this.game = game;
86
86
  this.name = key;
87
87
  this.key = key;
@@ -116,7 +116,7 @@ export class Sound {
116
116
  : this.context!.createGain();
117
117
  this.gainNode = gainNode;
118
118
  gainNode.gain.value = volume * this.game.sound.volume;
119
- if (connect && this.masterGainNode) {
119
+ if (connectToMaster && this.masterGainNode !== null) {
120
120
  gainNode.connect(this.masterGainNode);
121
121
  }
122
122
  this.onPlay = new Signal();
@@ -193,7 +193,7 @@ export class Sound {
193
193
  }
194
194
  if (this.externalNode) {
195
195
  this._sound.disconnect(this.externalNode);
196
- } else if (this.gainNode) {
196
+ } else if (this.gainNode as GainNode | undefined) {
197
197
  this._sound.disconnect(this.gainNode);
198
198
  }
199
199
  if (this._removeFromSoundManager) {
@@ -270,16 +270,14 @@ export class Sound {
270
270
  * @returns {Sound} This Sound instance for chaining.
271
271
  */
272
272
  public play(marker: string | false | null = '', position = 0, volume = 1, loop = false, forceRestart = true): this {
273
- if (marker === undefined || marker === false || marker === null) {
274
- marker = '';
275
- }
276
- forceRestart ??= true;
273
+ const markerName = marker === undefined || marker === false || marker === null ? '' : marker;
277
274
 
278
275
  if (this.isPlaying && !this.allowMultiple && !forceRestart && !this.override) {
279
276
  // Use Restart instead
280
277
  return this;
281
278
  }
282
- if (this._sound && this.isPlaying && !this.allowMultiple && (this.override || forceRestart)) {
279
+ const source = this._sound as AudioBufferSourceNode | undefined;
280
+ if (source && this.isPlaying && !this.allowMultiple && (this.override || forceRestart)) {
283
281
  if (this._sound.stop === undefined) {
284
282
  (this._sound as unknown as LegacyBufferSource).noteOff(0);
285
283
  } else {
@@ -287,20 +285,20 @@ export class Sound {
287
285
  }
288
286
  if (this.externalNode) {
289
287
  this._sound.disconnect(this.externalNode);
290
- } else if (this.gainNode) {
288
+ } else if (this.gainNode as GainNode | undefined) {
291
289
  this._sound.disconnect(this.gainNode);
292
290
  }
293
291
  this.isPlaying = false;
294
292
  }
295
- if (marker === '' && Object.keys(this.markers).length > 0) {
293
+ if (markerName === '' && Object.keys(this.markers).length > 0) {
296
294
  // If they didn't specify a marker but this is an audio sprite,
297
295
  // We should never play the entire thing
298
296
  return this;
299
297
  }
300
- const markerData = marker === '' ? undefined : this.markers[marker];
301
- if (marker !== '') {
298
+ const markerData = markerName === '' ? undefined : this.markers[markerName];
299
+ if (markerName !== '') {
302
300
  if (markerData) {
303
- this.currentMarker = marker;
301
+ this.currentMarker = markerName;
304
302
  // Playing a marker? Then we default to the marker values
305
303
  this.position = markerData.start;
306
304
  this.volume = markerData.volume;
@@ -313,32 +311,27 @@ export class Sound {
313
311
  if (loop !== undefined) {
314
312
  this.loop = loop;
315
313
  }
316
- this._tempMarker = marker;
314
+ this._tempMarker = markerName;
317
315
  this._tempPosition = this.position;
318
316
  this._tempVolume = this.volume;
319
317
  this._tempLoop = this.loop;
320
318
  } else {
321
- this.game.logger.warn(`Sound.play: audio marker ${marker} does not exist`);
319
+ this.game.logger.warn(`Sound.play: audio marker ${markerName} does not exist`);
322
320
  return this;
323
321
  }
324
322
  } else {
325
- position ??= 0;
326
- volume ??= this._volume;
327
- if (loop === undefined) {
328
- ({ loop } = this);
329
- }
330
- this.position = Math.max(0, position);
331
- this.volume = volume;
332
- this.loop = loop;
323
+ this.position = Math.max(0, position ?? 0);
324
+ this.volume = volume ?? this._volume;
325
+ this.loop = loop ?? this.loop;
333
326
  this.duration = 0;
334
327
  this.durationMS = 0;
335
- this._tempMarker = marker;
328
+ this._tempMarker = markerName;
336
329
  this._tempPosition = position;
337
330
  this._tempVolume = volume;
338
331
  this._tempLoop = loop;
339
332
  }
340
333
  // Does the sound need decoding?
341
- if (this.game.cache.isSoundDecoded(this.key)) {
334
+ if (this.game.cache.isSoundDecoded(this.key) === true) {
342
335
  this._sound = this.context!.createBufferSource();
343
336
  if (this.externalNode) {
344
337
  this._sound.connect(this.externalNode);
@@ -347,10 +340,10 @@ export class Sound {
347
340
  }
348
341
  this._buffer = this.game.cache.getSoundData(this.key) as AudioBuffer | null;
349
342
  this._sound.buffer = this._buffer;
350
- if (this.loop && marker === '') {
343
+ if (this.loop && markerName === '') {
351
344
  this._sound.loop = true;
352
345
  }
353
- if (!this.loop && marker === '') {
346
+ if (!this.loop && markerName === '') {
354
347
  this._sound.addEventListener('ended', this.onEndedHandler, { once: true });
355
348
  }
356
349
  this.totalDuration = this._sound.buffer?.duration ?? 0;
@@ -361,7 +354,7 @@ export class Sound {
361
354
  // Useful to cache this somewhere perhaps?
362
355
  if (this._sound.start === undefined) {
363
356
  (this._sound as unknown as LegacyBufferSource).noteGrainOn(0, this.position, this.duration);
364
- } else if (this.loop && marker === '') {
357
+ } else if (this.loop && markerName === '') {
365
358
  this._sound.start(0, 0);
366
359
  } else {
367
360
  this._sound.start(0, this.position, this.duration);
@@ -395,7 +388,7 @@ export class Sound {
395
388
  * Pauses the sound.
396
389
  */
397
390
  public pause(): void {
398
- if (this.isPlaying && this._sound) {
391
+ if (this.isPlaying && (this._sound as AudioBufferSourceNode | undefined)) {
399
392
  this.paused = true;
400
393
  this.pausedPosition = this.currentTime;
401
394
  this.pausedTime = this.game.time.time;
@@ -409,7 +402,7 @@ export class Sound {
409
402
  * Resumes the sound.
410
403
  */
411
404
  public resume(): void {
412
- if (this.paused && this._sound) {
405
+ if (this.paused && (this._sound as AudioBufferSourceNode | undefined)) {
413
406
  const p = Math.max(0, this.position + this.pausedPosition / 1000);
414
407
  this._sound = this.context!.createBufferSource();
415
408
  this._sound.buffer = this._buffer;
@@ -441,7 +434,7 @@ export class Sound {
441
434
  * Stops the sound.
442
435
  */
443
436
  public stop(): void {
444
- if (this.isPlaying && this._sound) {
437
+ if (this.isPlaying && (this._sound as AudioBufferSourceNode | undefined)) {
445
438
  if (this._sound.stop === undefined) {
446
439
  (this._sound as unknown as LegacyBufferSource).noteOff(0);
447
440
  } else {
@@ -449,7 +442,7 @@ export class Sound {
449
442
  }
450
443
  if (this.externalNode) {
451
444
  this._sound.disconnect(this.externalNode);
452
- } else if (this.gainNode) {
445
+ } else if (this.gainNode as GainNode | undefined) {
453
446
  this._sound.disconnect(this.gainNode);
454
447
  }
455
448
  }
@@ -73,7 +73,7 @@ export class SoundManager {
73
73
  setAudioDisabledState();
74
74
  return;
75
75
  }
76
- if (globalThis.AudioContext) {
76
+ if (globalThis.AudioContext as typeof AudioContext | undefined) {
77
77
  try {
78
78
  this.game.logger.info('initAudioContext');
79
79
  this.context = new globalThis.AudioContext();
@@ -240,7 +240,7 @@ export class SoundManager {
240
240
  return;
241
241
  }
242
242
  for (const sound of this._sounds) {
243
- if (sound) {
243
+ if (sound !== null) {
244
244
  sound.stop();
245
245
  }
246
246
  }
@@ -254,7 +254,7 @@ export class SoundManager {
254
254
  return;
255
255
  }
256
256
  for (const sound of this._sounds) {
257
- if (sound) {
257
+ if (sound !== null) {
258
258
  sound.pause();
259
259
  }
260
260
  }
@@ -268,7 +268,7 @@ export class SoundManager {
268
268
  return;
269
269
  }
270
270
  for (const sound of this._sounds) {
271
- if (sound) {
271
+ if (sound !== null) {
272
272
  sound.resume();
273
273
  }
274
274
  }
@@ -317,7 +317,7 @@ export class SoundManager {
317
317
  this._watchList.reset();
318
318
  for (const file of candidates) {
319
319
  const key = file instanceof Sound ? file.key : file;
320
- if (!this.game.cache.isSoundDecoded(key)) {
320
+ if (this.game.cache.isSoundDecoded(key) !== true) {
321
321
  this._watchList.add(key);
322
322
  }
323
323
  }
@@ -344,8 +344,8 @@ export class SoundManager {
344
344
  }
345
345
  if (this._watching) {
346
346
  let key = this._watchList.first;
347
- while (key) {
348
- if (this.game.cache.isSoundDecoded(key)) {
347
+ while (key !== null) {
348
+ if (this.game.cache.isSoundDecoded(key) === true) {
349
349
  this._watchList.remove(key);
350
350
  }
351
351
  key = this._watchList.next;
@@ -469,7 +469,7 @@ export class SoundManager {
469
469
  public destroy(): void {
470
470
  this.stopAll();
471
471
  for (const sound of this._sounds) {
472
- if (sound) {
472
+ if (sound !== null) {
473
473
  sound.destroy();
474
474
  }
475
475
  }
@@ -519,15 +519,11 @@ export class SoundManager {
519
519
  * Sets the volume level of the sound manager.
520
520
  */
521
521
  public set volume(value: number) {
522
- if (value < 0) {
523
- value = 0;
524
- } else if (value > 1) {
525
- value = 1;
526
- }
527
- if (this._volume !== value) {
528
- this._volume = value;
522
+ const level = Math.min(1, Math.max(0, value));
523
+ if (this._volume !== level) {
524
+ this._volume = level;
529
525
  if (!this.noAudio) {
530
- this.masterGain.gain.value = value;
526
+ this.masterGain.gain.value = level;
531
527
  }
532
528
  }
533
529
  }
@@ -38,7 +38,7 @@ export class SoundSprite {
38
38
  sound.addMarker(markerKey, marker.start, marker.end - marker.start, undefined, marker.loop);
39
39
  this.sounds[markerKey] = sound;
40
40
  }
41
- if (this.config.autoplay) {
41
+ if (this.config.autoplay !== undefined) {
42
42
  this.autoplayKey = this.config.autoplay;
43
43
  this.play(this.autoplayKey);
44
44
  this.autoplay = this.sounds[this.autoplayKey]!;
@@ -37,11 +37,11 @@ export class Stage extends DisplayObject {
37
37
  color: 0,
38
38
  rgba: '#000000',
39
39
  };
40
- if (!game.config.transparent) {
40
+ if (game.config.transparent === false) {
41
41
  // transparent = 0,0,0,0 - otherwise r,g,b,1
42
42
  this._bgColor.a = 1;
43
43
  }
44
- if (game.config.backgroundColor && !this.game.config.transparent) {
44
+ if (game.config.backgroundColor !== 0 && this.game.config.transparent === false) {
45
45
  this.setBackgroundColor(game.config.backgroundColor);
46
46
  }
47
47
  }
@@ -51,7 +51,7 @@ export class Stage extends DisplayObject {
51
51
  * @param {number} color - The color to set as the background.
52
52
  */
53
53
  public setBackgroundColor(color: number): void {
54
- if (this.game.config.transparent) {
54
+ if (this.game.config.transparent !== false) {
55
55
  return;
56
56
  }
57
57
  valueToColor(color, this._bgColor);
@@ -215,7 +215,7 @@ export class Timer {
215
215
  this._i = this.events.length;
216
216
  while (this._i) {
217
217
  this._i -= 1;
218
- if (this.events[this._i]?.pendingDelete) {
218
+ if (this.events[this._i]?.pendingDelete === true) {
219
219
  this.events.splice(this._i, 1);
220
220
  }
221
221
  }
@@ -167,10 +167,7 @@ export class Tween {
167
167
  }
168
168
  this.manager.add(this);
169
169
  this.isRunning = true;
170
- if (index < 0 || index > this.timeline.length - 1) {
171
- index = 0;
172
- }
173
- this.current = index;
170
+ this.current = index < 0 || index > this.timeline.length - 1 ? 0 : index;
174
171
  this.timeline[this.current]!.start();
175
172
  return this;
176
173
  }
@@ -290,10 +287,7 @@ export class Tween {
290
287
  * @returns {Tween} This Tween object for chaining.
291
288
  */
292
289
  public easing(ease: string | EasingFunction, index: number): this {
293
- if (typeof ease === 'string' && this.manager.easeMap[ease]) {
294
- ease = this.manager.easeMap[ease]!;
295
- }
296
- return this.updateTweenData('easingFunction', ease, index);
290
+ return this.updateTweenData('easingFunction', this.resolveEasing(ease), index);
297
291
  }
298
292
 
299
293
  /**
@@ -407,7 +401,7 @@ export class Tween {
407
401
  * @returns {boolean} True if the tween should continue running, false if it's complete.
408
402
  */
409
403
  public update(time: number): boolean {
410
- if (this.pendingDelete || !this.target) {
404
+ if (this.pendingDelete || !(this.target as TweenTarget | undefined)) {
411
405
  return false;
412
406
  }
413
407
  if (this.isPaused) {
@@ -507,10 +501,11 @@ export class Tween {
507
501
  for (const tweenData of this.timeline) {
508
502
  tweenData.loadValues();
509
503
  }
504
+ const frames = [...data];
510
505
  for (const tweenData of this.timeline) {
511
- data = [...data, ...tweenData.generateData(frameRate)];
506
+ frames.push(...tweenData.generateData(frameRate));
512
507
  }
513
- return data;
508
+ return frames;
514
509
  }
515
510
 
516
511
  /**
@@ -80,7 +80,7 @@ export class BitmapText extends DisplayObject {
80
80
  return;
81
81
  }
82
82
 
83
- if (!this.exists || !this.parent?.exists) {
83
+ if (!this.exists || this.parent?.exists !== true) {
84
84
  this.renderOrderID = -1;
85
85
  return;
86
86
  }
@@ -150,7 +150,7 @@ export class BitmapText extends DisplayObject {
150
150
  // What will the line width be if we add this character to it?
151
151
  c = (kerning + (charData.texture?.width ?? 0) + charData.xOffset) * scale;
152
152
  // Do we need to line-wrap?
153
- if (maxWidth && w + c >= maxWidth && lastSpace > -1) {
153
+ if (maxWidth !== null && w + c >= maxWidth && lastSpace > -1) {
154
154
  // The last space was at "lastSpace" which was "i - lastSpace" characters ago
155
155
  return {
156
156
  width: wrappedWidth || w,
@@ -463,7 +463,7 @@ export class BitmapText extends DisplayObject {
463
463
  * @returns {boolean} True if smoothing is enabled, false otherwise.
464
464
  */
465
465
  public get smoothed(): boolean {
466
- return !this._data?.base.scaleMode;
466
+ return this._data?.base.scaleMode === 0;
467
467
  }
468
468
 
469
469
  /**
@@ -93,7 +93,7 @@ export class Button extends Image {
93
93
  this._onDownFrame = null;
94
94
  this._onUpFrame = null;
95
95
  this._onDisabledFrame = null;
96
- if (this.onInputOver) {
96
+ if (this.onInputOver !== null) {
97
97
  this.onInputOver.dispose();
98
98
  this.onInputOut.dispose();
99
99
  this.onInputDown.dispose();
@@ -103,7 +103,7 @@ export class Button extends Image {
103
103
  this.onInputOut = null!;
104
104
  this.onInputDown = null!;
105
105
  this.onInputUp = null!;
106
- if (this.input) {
106
+ if (this.input !== null) {
107
107
  this.input.destroy();
108
108
  }
109
109
  this.input = null!;
@@ -148,7 +148,7 @@ export class Button extends Image {
148
148
  */
149
149
  public setStateFrame(state: string, frame: string | null, switchImmediately = false): void {
150
150
  const frameKey: `_on${string}Frame` = `_on${state}Frame`;
151
- if (frame) {
151
+ if (frame !== null) {
152
152
  this[frameKey] = frame;
153
153
  if (switchImmediately) {
154
154
  this.changeStateFrame(state);
@@ -167,7 +167,7 @@ export class Button extends Image {
167
167
  if (this.freezeFrames) {
168
168
  return false;
169
169
  }
170
- const state = this.input.enabled || !this._onDisabledFrame ? newState : STATE_DISABLED;
170
+ const state = this.input.enabled || this._onDisabledFrame === null ? newState : STATE_DISABLED;
171
171
  const frameKey: `_on${string}Frame` = `_on${state}Frame`;
172
172
  const frame = this[frameKey];
173
173
  if (typeof frame === 'string') {
@@ -199,7 +199,7 @@ export class Button extends Image {
199
199
  this.setStateFrame(STATE_OUT, outFrame, !this.input.pointerOver());
200
200
  this.setStateFrame(STATE_DOWN, downFrame, this.input.pointerDown());
201
201
  this.setStateFrame(STATE_UP, upFrame, this.input.pointerUp());
202
- if (disabledFrame) {
202
+ if (disabledFrame !== null) {
203
203
  this.setStateFrame(STATE_DISABLED, disabledFrame, !this.input.enabled);
204
204
  }
205
205
  }
@@ -218,7 +218,7 @@ export class Button extends Image {
218
218
  if (this.onOverMouseOnly && !pointer.isMouse) {
219
219
  return;
220
220
  }
221
- if (this.onInputOver) {
221
+ if (this.onInputOver !== null) {
222
222
  this.onInputOver.dispatch(this, pointer);
223
223
  }
224
224
  }
@@ -230,7 +230,7 @@ export class Button extends Image {
230
230
  */
231
231
  public onInputOutHandler(_sprite: Image, pointer: Pointer): void {
232
232
  this.changeStateFrame(STATE_OUT);
233
- if (this.onInputOut) {
233
+ if (this.onInputOut !== null) {
234
234
  this.onInputOut.dispatch(this, pointer);
235
235
  }
236
236
  }
@@ -242,7 +242,7 @@ export class Button extends Image {
242
242
  */
243
243
  public onInputDownHandler(_sprite: Image, pointer: Pointer): void {
244
244
  this.changeStateFrame(STATE_DOWN);
245
- if (this.onInputDown) {
245
+ if (this.onInputDown !== null) {
246
246
  this.onInputDown.dispatch(this, pointer);
247
247
  }
248
248
  }
@@ -254,7 +254,7 @@ export class Button extends Image {
254
254
  * @param {boolean} isOver - Whether the pointer is currently over the button (default: true).
255
255
  */
256
256
  public onInputUpHandler(_sprite: Image, pointer: Pointer, isOver: boolean): void {
257
- if (this.onInputUp) {
257
+ if (this.onInputUp !== null) {
258
258
  this.onInputUp.dispatch(this, pointer, isOver);
259
259
  }
260
260
  if (this.freezeFrames) {
@@ -281,7 +281,7 @@ export class Button extends Image {
281
281
  * @returns {boolean} True if input is enabled, false otherwise.
282
282
  */
283
283
  public get inputEnabled(): boolean {
284
- return this.input && this.input.enabled;
284
+ return this.input !== null && this.input.enabled;
285
285
  }
286
286
 
287
287
  /**
@@ -293,10 +293,10 @@ export class Button extends Image {
293
293
  if (this.input === null) {
294
294
  this.input = new InputHandler(this);
295
295
  this.input.start();
296
- } else if (this.input && !this.input.enabled) {
296
+ } else if (this.input !== null && !this.input.enabled) {
297
297
  this.input.start();
298
298
  }
299
- } else if (this.input && this.input.enabled) {
299
+ } else if (this.input !== null && this.input.enabled) {
300
300
  this.input.stop();
301
301
  }
302
302
  }
@@ -71,7 +71,7 @@ export const renderGraphics = (graphics: Graphics, context: CanvasRenderingConte
71
71
  context.stroke();
72
72
  }
73
73
  } else if (shape instanceof Rectangle) {
74
- if (data.fillColor || data.fillColor === 0) {
74
+ if (data.fillColor !== null) {
75
75
  context.globalAlpha = data.fillAlpha * worldAlpha;
76
76
  context.fillStyle = `#${`00000${Math.trunc(fillColor ?? 0).toString(16)}`.slice(-6)}`;
77
77
  context.fillRect(shape.x, shape.y, shape.width, shape.height);
@@ -144,7 +144,7 @@ export const renderGraphics = (graphics: Graphics, context: CanvasRenderingConte
144
144
  context.lineTo(rx + radius, ry);
145
145
  context.quadraticCurveTo(rx, ry, rx, ry + radius);
146
146
  context.closePath();
147
- if (data.fillColor || data.fillColor === 0) {
147
+ if (data.fillColor !== null) {
148
148
  context.globalAlpha = data.fillAlpha * worldAlpha;
149
149
  context.fillStyle = `#${`00000${Math.trunc(fillColor ?? 0).toString(16)}`.slice(-6)}`;
150
150
  context.fill();
@@ -16,7 +16,7 @@ export const getPool = (): CanvasPoolEntry[] => {
16
16
  export const getFirst = (): number => {
17
17
  const pool = getPool();
18
18
  for (let i = 0; i < pool.length; i += 1) {
19
- if (!pool[i]!.parent) {
19
+ if (pool[i]!.parent === null) {
20
20
  return i;
21
21
  }
22
22
  }
@@ -61,7 +61,7 @@ export const getTotal = (): number => {
61
61
  const pool = getPool();
62
62
  let c = 0;
63
63
  for (const entry of pool) {
64
- if (entry.parent) {
64
+ if (entry.parent !== null) {
65
65
  c += 1;
66
66
  }
67
67
  }
@@ -76,7 +76,7 @@ export const getFree = (): number => {
76
76
  const pool = getPool();
77
77
  let c = 0;
78
78
  for (const entry of pool) {
79
- if (!entry.parent) {
79
+ if (entry.parent === null) {
80
80
  c += 1;
81
81
  }
82
82
  }