@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.
- package/dist/index.js +305 -309
- package/dist/index.js.map +1 -1
- package/dist/phaser/core/animation_parser.d.ts.map +1 -1
- package/dist/phaser/core/dom.d.ts.map +1 -1
- package/dist/phaser/core/frame_data.d.ts.map +1 -1
- package/dist/phaser/core/loader.d.ts.map +1 -1
- package/dist/phaser/core/scale_manager.d.ts.map +1 -1
- package/dist/phaser/core/sound.d.ts.map +1 -1
- package/dist/phaser/core/sound_manager.d.ts.map +1 -1
- package/dist/phaser/core/tween.d.ts.map +1 -1
- package/dist/phaser/display/canvas/renderer.d.ts.map +1 -1
- package/dist/phaser/display/display_object.d.ts +2 -2
- package/dist/phaser/display/display_object.d.ts.map +1 -1
- package/dist/phaser/display/graphics.d.ts +1 -1
- package/dist/phaser/display/graphics.d.ts.map +1 -1
- package/dist/phaser/display/group.d.ts.map +1 -1
- package/dist/phaser/display/image.d.ts.map +1 -1
- package/dist/phaser/display/text.d.ts.map +1 -1
- package/dist/phaser/display/webgl/earcut.d.ts.map +1 -1
- package/dist/phaser/display/webgl/texture.d.ts.map +1 -1
- package/dist/phaser/geom/rectangle.d.ts.map +1 -1
- package/dist/phaser/geom/util/circle.d.ts.map +1 -1
- package/dist/phaser/geom/util/point.d.ts.map +1 -1
- package/dist/phaser/util/math.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/phaser/core/animation.ts +7 -7
- package/src/phaser/core/animation_manager.ts +2 -2
- package/src/phaser/core/animation_parser.ts +11 -15
- package/src/phaser/core/array_set.ts +2 -2
- package/src/phaser/core/cache.ts +4 -4
- package/src/phaser/core/device_util.ts +4 -4
- package/src/phaser/core/dom.ts +23 -19
- package/src/phaser/core/frame_data.ts +2 -5
- package/src/phaser/core/game.ts +12 -12
- package/src/phaser/core/input.ts +2 -2
- package/src/phaser/core/input_handler.ts +13 -13
- package/src/phaser/core/input_mouse.ts +4 -4
- package/src/phaser/core/input_pointer.ts +1 -1
- package/src/phaser/core/loader.ts +38 -50
- package/src/phaser/core/scale_manager.ts +10 -9
- package/src/phaser/core/scene_manager.ts +2 -2
- package/src/phaser/core/signal.ts +2 -2
- package/src/phaser/core/sound.ts +25 -32
- package/src/phaser/core/sound_manager.ts +12 -16
- package/src/phaser/core/sound_sprite.ts +1 -1
- package/src/phaser/core/stage.ts +3 -3
- package/src/phaser/core/timer.ts +1 -1
- package/src/phaser/core/tween.ts +6 -11
- package/src/phaser/display/bitmap_text.ts +3 -3
- package/src/phaser/display/button.ts +12 -12
- package/src/phaser/display/canvas/graphics.ts +2 -2
- package/src/phaser/display/canvas/pool.ts +3 -3
- package/src/phaser/display/canvas/renderer.ts +6 -5
- package/src/phaser/display/canvas/tinter.ts +1 -1
- package/src/phaser/display/canvas/util.ts +2 -2
- package/src/phaser/display/display_object.ts +13 -14
- package/src/phaser/display/graphics.test.ts +2 -2
- package/src/phaser/display/graphics.ts +9 -11
- package/src/phaser/display/group.ts +10 -9
- package/src/phaser/display/image.ts +7 -6
- package/src/phaser/display/sprite_util.ts +1 -1
- package/src/phaser/display/text.ts +35 -44
- package/src/phaser/display/webgl/abstract_filter.ts +1 -1
- package/src/phaser/display/webgl/earcut.ts +46 -42
- package/src/phaser/display/webgl/graphics.ts +1 -1
- package/src/phaser/display/webgl/renderer.ts +3 -3
- package/src/phaser/display/webgl/shader/normal.ts +6 -6
- package/src/phaser/display/webgl/shader_manager.ts +1 -1
- package/src/phaser/display/webgl/sprite_batch.ts +2 -2
- package/src/phaser/display/webgl/texture.ts +2 -1
- package/src/phaser/display/webgl/util.ts +3 -3
- package/src/phaser/geom/polygon.ts +2 -2
- package/src/phaser/geom/rectangle.ts +1 -2
- package/src/phaser/geom/util/circle.ts +6 -10
- package/src/phaser/geom/util/point.ts +5 -7
- package/src/phaser/util/math.ts +2 -3
package/dist/index.js
CHANGED
|
@@ -128,11 +128,11 @@ const distance$1 = (a, b, round = false) => {
|
|
|
128
128
|
* @returns {Point} The rotated point instance for chaining.
|
|
129
129
|
*/
|
|
130
130
|
const rotate = (a, x, y, ang, asDegrees, dist) => {
|
|
131
|
-
|
|
131
|
+
const radians = asDegrees ? ang * (Math.PI / 180) : ang;
|
|
132
132
|
if (dist === void 0 || dist === null) {
|
|
133
133
|
a.subtract(x, y);
|
|
134
|
-
const s = Math.sin(
|
|
135
|
-
const c = Math.cos(
|
|
134
|
+
const s = Math.sin(radians);
|
|
135
|
+
const c = Math.cos(radians);
|
|
136
136
|
const tx = c * a.x - s * a.y;
|
|
137
137
|
const ty = s * a.x + c * a.y;
|
|
138
138
|
a.x = tx + x;
|
|
@@ -886,9 +886,8 @@ var Rectangle = class {
|
|
|
886
886
|
* @returns {Rectangle} This rectangle instance for chaining.
|
|
887
887
|
*/
|
|
888
888
|
scale(x, y) {
|
|
889
|
-
y ??= x;
|
|
890
889
|
this.width *= x;
|
|
891
|
-
this.height *= y;
|
|
890
|
+
this.height *= y ?? x;
|
|
892
891
|
return this;
|
|
893
892
|
}
|
|
894
893
|
/**
|
|
@@ -1342,9 +1341,7 @@ const between = (min, max) => Math.floor(Math.random() * (max - min + 1) + min);
|
|
|
1342
1341
|
/** Snaps a value to the nearest multiple of gap, starting from start. */
|
|
1343
1342
|
const snapToCeil = (input, gap = 0, start = 0) => {
|
|
1344
1343
|
if (gap === 0) return input;
|
|
1345
|
-
input
|
|
1346
|
-
input = gap * Math.ceil(input / gap);
|
|
1347
|
-
return start + input;
|
|
1344
|
+
return start + gap * Math.ceil((input - start) / gap);
|
|
1348
1345
|
};
|
|
1349
1346
|
/** Wraps a value within a range. */
|
|
1350
1347
|
const wrap = (value, min, max) => {
|
|
@@ -1465,7 +1462,7 @@ const getPool = () => {
|
|
|
1465
1462
|
*/
|
|
1466
1463
|
const getFirst = () => {
|
|
1467
1464
|
const pool = getPool();
|
|
1468
|
-
for (let i = 0; i < pool.length; i += 1) if (
|
|
1465
|
+
for (let i = 0; i < pool.length; i += 1) if (pool[i].parent === null) return i;
|
|
1469
1466
|
return -1;
|
|
1470
1467
|
};
|
|
1471
1468
|
/**
|
|
@@ -1631,7 +1628,7 @@ const canUseNewCanvasBlendModes = () => {
|
|
|
1631
1628
|
context.globalCompositeOperation = "multiply";
|
|
1632
1629
|
context.drawImage(magenta, 0, 0);
|
|
1633
1630
|
context.drawImage(yellow, 2, 0);
|
|
1634
|
-
if (
|
|
1631
|
+
if (context.getImageData(2, 0, 1, 1) === null) return false;
|
|
1635
1632
|
const { data } = context.getImageData(2, 0, 1, 1);
|
|
1636
1633
|
try {
|
|
1637
1634
|
context.reset();
|
|
@@ -1750,7 +1747,7 @@ const getSmoothingPrefix = (context) => {
|
|
|
1750
1747
|
const smoothingFlags = context;
|
|
1751
1748
|
for (const vendor of VENDORS) {
|
|
1752
1749
|
const flag = `${vendor}mageSmoothingEnabled`;
|
|
1753
|
-
if (smoothingFlags[flag]) return flag;
|
|
1750
|
+
if (smoothingFlags[flag] !== void 0) return flag;
|
|
1754
1751
|
}
|
|
1755
1752
|
return null;
|
|
1756
1753
|
};
|
|
@@ -1918,7 +1915,7 @@ const renderCanvas = (target, renderSession, matrix = null) => {
|
|
|
1918
1915
|
if (target.texture.valid) {
|
|
1919
1916
|
const resolution = target.texture.baseTexture.resolution / renderSession.resolution;
|
|
1920
1917
|
renderSession.context.globalAlpha = target.worldAlpha;
|
|
1921
|
-
if (renderSession.smoothProperty && renderSession.scaleMode !== target.texture.baseTexture.scaleMode) {
|
|
1918
|
+
if (renderSession.smoothProperty !== null && renderSession.scaleMode !== target.texture.baseTexture.scaleMode) {
|
|
1922
1919
|
renderSession.scaleMode = target.texture.baseTexture.scaleMode;
|
|
1923
1920
|
setSmoothing(renderSession.context, renderSession.smoothProperty, renderSession.scaleMode === 0);
|
|
1924
1921
|
}
|
|
@@ -2188,11 +2185,11 @@ var DisplayObject = class {
|
|
|
2188
2185
|
* @throws {Error} If the range is invalid.
|
|
2189
2186
|
*/
|
|
2190
2187
|
removeChildren(beginIndex, endIndex) {
|
|
2191
|
-
beginIndex
|
|
2192
|
-
endIndex
|
|
2193
|
-
const range =
|
|
2194
|
-
if (range > 0 && range <=
|
|
2195
|
-
const removed = this.children.splice(
|
|
2188
|
+
const begin = beginIndex ?? 0;
|
|
2189
|
+
const end = endIndex ?? this.children.length;
|
|
2190
|
+
const range = end - begin;
|
|
2191
|
+
if (range > 0 && range <= end) {
|
|
2192
|
+
const removed = this.children.splice(begin, range);
|
|
2196
2193
|
for (const child of removed) child.parent = null;
|
|
2197
2194
|
return removed;
|
|
2198
2195
|
}
|
|
@@ -2440,9 +2437,9 @@ var DisplayObject = class {
|
|
|
2440
2437
|
* @returns {Point} The converted local position.
|
|
2441
2438
|
*/
|
|
2442
2439
|
toLocal(position, from) {
|
|
2443
|
-
|
|
2440
|
+
const global = from ? from.toGlobal(position) : position;
|
|
2444
2441
|
this.updateTransform();
|
|
2445
|
-
return this.worldTransform.applyInverse(
|
|
2442
|
+
return this.worldTransform.applyInverse(global);
|
|
2446
2443
|
}
|
|
2447
2444
|
/**
|
|
2448
2445
|
* Renders a cached sprite for this display object.
|
|
@@ -2886,14 +2883,14 @@ var Signal = class {
|
|
|
2886
2883
|
let n = this._bindings.length;
|
|
2887
2884
|
while (n) {
|
|
2888
2885
|
n -= 1;
|
|
2889
|
-
if (context) {
|
|
2886
|
+
if (context !== null) {
|
|
2890
2887
|
if (this._bindings[n].context === context) {
|
|
2891
2888
|
this._bindings[n]._destroy();
|
|
2892
2889
|
this._bindings.splice(n, 1);
|
|
2893
2890
|
}
|
|
2894
2891
|
} else this._bindings[n]._destroy();
|
|
2895
2892
|
}
|
|
2896
|
-
if (
|
|
2893
|
+
if (context === null) this._bindings.length = 0;
|
|
2897
2894
|
}
|
|
2898
2895
|
/**
|
|
2899
2896
|
* Get the number of listeners registered with the signal.
|
|
@@ -3119,7 +3116,7 @@ var Animation = class {
|
|
|
3119
3116
|
if (useLocalFrameIndex) frameIndex = frameId;
|
|
3120
3117
|
else for (let i = 0; i < this._frames.length; i += 1) if (this._frames[i] === frameId) frameIndex = i;
|
|
3121
3118
|
}
|
|
3122
|
-
if (frameIndex) {
|
|
3119
|
+
if (frameIndex !== void 0 && frameIndex !== 0) {
|
|
3123
3120
|
this._frameIndex = frameIndex - 1;
|
|
3124
3121
|
this._timeNextFrame = this.game.time.time;
|
|
3125
3122
|
this.update();
|
|
@@ -3136,7 +3133,7 @@ var Animation = class {
|
|
|
3136
3133
|
this.paused = false;
|
|
3137
3134
|
if (resetFrame) {
|
|
3138
3135
|
this.currentFrame = this._frameData.getFrame(this._frames[0]);
|
|
3139
|
-
if (this.currentFrame) this._parent.setFrame(this.currentFrame);
|
|
3136
|
+
if (this.currentFrame !== null) this._parent.setFrame(this.currentFrame);
|
|
3140
3137
|
}
|
|
3141
3138
|
if (dispatchComplete) {
|
|
3142
3139
|
this._parent.events.onAnimationComplete$dispatch(this._parent, this);
|
|
@@ -3177,7 +3174,7 @@ var Animation = class {
|
|
|
3177
3174
|
this._frameIndex = Math.abs(this._frameIndex) % this._frames.length;
|
|
3178
3175
|
if (this.isReversed) this._frameIndex = this._frames.length - 1 - this._frameIndex;
|
|
3179
3176
|
this.currentFrame = this._frameData.getFrame(this._frames[this._frameIndex]);
|
|
3180
|
-
if (this.currentFrame) this._parent.setFrame(this.currentFrame);
|
|
3177
|
+
if (this.currentFrame !== null) this._parent.setFrame(this.currentFrame);
|
|
3181
3178
|
this.loopCount += 1;
|
|
3182
3179
|
this._parent.events.onAnimationLoop$dispatch(this._parent, this);
|
|
3183
3180
|
this.onLoop.dispatch(this._parent, this);
|
|
@@ -3201,10 +3198,10 @@ var Animation = class {
|
|
|
3201
3198
|
* @returns {boolean} True if the frame was updated, false otherwise.
|
|
3202
3199
|
*/
|
|
3203
3200
|
updateCurrentFrame(signalUpdate, fromPlay = false) {
|
|
3204
|
-
if (!this._frameData ||
|
|
3201
|
+
if (!this._frameData || this.currentFrame === null) return false;
|
|
3205
3202
|
const idx = this.currentFrame.index;
|
|
3206
3203
|
this.currentFrame = this._frameData.getFrame(this._frames[this._frameIndex]);
|
|
3207
|
-
if (this.currentFrame && (fromPlay ||
|
|
3204
|
+
if (this.currentFrame !== null && (fromPlay || idx !== this.currentFrame.index)) this._parent.setFrame(this.currentFrame);
|
|
3208
3205
|
if (this.onUpdate && signalUpdate) {
|
|
3209
3206
|
this.onUpdate.dispatch(this, this.currentFrame);
|
|
3210
3207
|
return Boolean(this._frameData);
|
|
@@ -3599,7 +3596,7 @@ var AnimationManager = class {
|
|
|
3599
3596
|
set frame(value) {
|
|
3600
3597
|
if (typeof value === "number" && this._frameData && this._frameData.getFrame(value) !== null) {
|
|
3601
3598
|
this.currentFrame = this._frameData.getFrame(value);
|
|
3602
|
-
if (this.currentFrame) this.sprite.setFrame(this.currentFrame);
|
|
3599
|
+
if (this.currentFrame !== null) this.sprite.setFrame(this.currentFrame);
|
|
3603
3600
|
} else this.game.logger.fatal("AnimationManager", {
|
|
3604
3601
|
error: /* @__PURE__ */ new Error(ENGINE_ERROR_CANNOT_SET_FRAME),
|
|
3605
3602
|
tags: { "asset.key": value }
|
|
@@ -3619,7 +3616,7 @@ var AnimationManager = class {
|
|
|
3619
3616
|
set frameName(value) {
|
|
3620
3617
|
if (typeof value === "string" && this._frameData && this._frameData.getFrameByName(value) !== null) {
|
|
3621
3618
|
this.currentFrame = this._frameData.getFrameByName(value);
|
|
3622
|
-
if (this.currentFrame) {
|
|
3619
|
+
if (this.currentFrame !== null) {
|
|
3623
3620
|
this._frameIndex = this.currentFrame.index;
|
|
3624
3621
|
this.sprite.setFrame(this.currentFrame);
|
|
3625
3622
|
}
|
|
@@ -3886,7 +3883,7 @@ var Texture = class Texture {
|
|
|
3886
3883
|
this.valid = false;
|
|
3887
3884
|
return;
|
|
3888
3885
|
}
|
|
3889
|
-
this.valid =
|
|
3886
|
+
this.valid = frame.width !== 0 && frame.height !== 0 && this.baseTexture.source !== null && this.baseTexture.hasLoaded;
|
|
3890
3887
|
if (this.trim) {
|
|
3891
3888
|
this.width = this.trim.width;
|
|
3892
3889
|
this.height = this.trim.height;
|
|
@@ -3929,8 +3926,7 @@ var FrameData = class {
|
|
|
3929
3926
|
return frame;
|
|
3930
3927
|
}
|
|
3931
3928
|
getFrame(index = 0) {
|
|
3932
|
-
|
|
3933
|
-
return this._frames[index];
|
|
3929
|
+
return this._frames[index >= this._frames.length ? 0 : index];
|
|
3934
3930
|
}
|
|
3935
3931
|
getFrameByName(name) {
|
|
3936
3932
|
const index = this._frameNames[name];
|
|
@@ -3951,7 +3947,7 @@ var FrameData = class {
|
|
|
3951
3947
|
}
|
|
3952
3948
|
getFrameIndexes(frames, useNumericIndex = true, output = null) {
|
|
3953
3949
|
const result = output ?? [];
|
|
3954
|
-
if (frames
|
|
3950
|
+
if (frames.length > 0) for (const f of frames) if (useNumericIndex && this._frames[f]) result.push(this._frames[f].index);
|
|
3955
3951
|
else {
|
|
3956
3952
|
const found = this.getFrameByName(f);
|
|
3957
3953
|
if (found) result.push(found.index);
|
|
@@ -4149,7 +4145,7 @@ var Image$1 = class extends DisplayObject {
|
|
|
4149
4145
|
this.destroy();
|
|
4150
4146
|
return;
|
|
4151
4147
|
}
|
|
4152
|
-
if (!this.exists ||
|
|
4148
|
+
if (!this.exists || this.parent?.exists !== true) {
|
|
4153
4149
|
this.renderOrderID = -1;
|
|
4154
4150
|
return;
|
|
4155
4151
|
}
|
|
@@ -4449,7 +4445,7 @@ var BitmapText = class extends DisplayObject {
|
|
|
4449
4445
|
this.destroy();
|
|
4450
4446
|
return;
|
|
4451
4447
|
}
|
|
4452
|
-
if (!this.exists ||
|
|
4448
|
+
if (!this.exists || this.parent?.exists !== true) {
|
|
4453
4449
|
this.renderOrderID = -1;
|
|
4454
4450
|
return;
|
|
4455
4451
|
}
|
|
@@ -4504,7 +4500,7 @@ var BitmapText = class extends DisplayObject {
|
|
|
4504
4500
|
wrappedWidth = w;
|
|
4505
4501
|
}
|
|
4506
4502
|
c = (kerning + (charData.texture?.width ?? 0) + charData.xOffset) * scale;
|
|
4507
|
-
if (maxWidth && w + c >= maxWidth && lastSpace > -1) return {
|
|
4503
|
+
if (maxWidth !== null && w + c >= maxWidth && lastSpace > -1) return {
|
|
4508
4504
|
width: wrappedWidth || w,
|
|
4509
4505
|
text: text.slice(0, lastSpace),
|
|
4510
4506
|
end,
|
|
@@ -4767,7 +4763,7 @@ var BitmapText = class extends DisplayObject {
|
|
|
4767
4763
|
* @returns {boolean} True if smoothing is enabled, false otherwise.
|
|
4768
4764
|
*/
|
|
4769
4765
|
get smoothed() {
|
|
4770
|
-
return
|
|
4766
|
+
return this._data?.base.scaleMode === 0;
|
|
4771
4767
|
}
|
|
4772
4768
|
/**
|
|
4773
4769
|
* Sets whether smoothing is enabled for this bitmap text's font.
|
|
@@ -4953,7 +4949,7 @@ var InputHandler = class {
|
|
|
4953
4949
|
* TBD.
|
|
4954
4950
|
*/
|
|
4955
4951
|
destroy() {
|
|
4956
|
-
if (this.sprite) {
|
|
4952
|
+
if (this.sprite !== null) {
|
|
4957
4953
|
if (this._setHandCursor) {
|
|
4958
4954
|
this.game.canvas.style.cursor = "default";
|
|
4959
4955
|
this._setHandCursor = false;
|
|
@@ -5090,7 +5086,7 @@ var InputHandler = class {
|
|
|
5090
5086
|
* @returns {boolean} TBD.
|
|
5091
5087
|
*/
|
|
5092
5088
|
checkPointerDown(pointer, fastTest = false) {
|
|
5093
|
-
if (!pointer.isDown || !this.enabled ||
|
|
5089
|
+
if (!pointer.isDown || !this.enabled || this.sprite === null || !this.sprite.parent || !this.sprite.visible || !this.sprite.parent.visible || this.sprite.worldScale.x === 0 || this.sprite.worldScale.y === 0) return false;
|
|
5094
5090
|
if (this.game.input.hitTest(this.sprite, pointer, this._tempPoint)) {
|
|
5095
5091
|
if (!fastTest && this.pixelPerfectClick) return this.checkPixel(this._tempPoint.x, this._tempPoint.y);
|
|
5096
5092
|
return true;
|
|
@@ -5104,7 +5100,7 @@ var InputHandler = class {
|
|
|
5104
5100
|
* @returns {boolean} TBD.
|
|
5105
5101
|
*/
|
|
5106
5102
|
checkPointerOver(pointer, fastTest = false) {
|
|
5107
|
-
if (!this.enabled ||
|
|
5103
|
+
if (!this.enabled || this.sprite === null || !this.sprite.parent || !this.sprite.visible || !this.sprite.parent.visible || this.sprite.worldScale.x === 0 || this.sprite.worldScale.y === 0) return false;
|
|
5108
5104
|
if (this.game.input.hitTest(this.sprite, pointer, this._tempPoint)) {
|
|
5109
5105
|
if (!fastTest && this.pixelPerfectOver) return this.checkPixel(this._tempPoint.x, this._tempPoint.y);
|
|
5110
5106
|
return true;
|
|
@@ -5154,7 +5150,7 @@ var InputHandler = class {
|
|
|
5154
5150
|
*/
|
|
5155
5151
|
update(pointer) {
|
|
5156
5152
|
if (this.sprite === null || this.sprite.parent === void 0) return false;
|
|
5157
|
-
if (!this.enabled || !this.sprite.visible ||
|
|
5153
|
+
if (!this.enabled || !this.sprite.visible || this.sprite.parent?.visible !== true) {
|
|
5158
5154
|
this._pointerOutHandler(pointer);
|
|
5159
5155
|
return false;
|
|
5160
5156
|
}
|
|
@@ -5193,7 +5189,7 @@ var InputHandler = class {
|
|
|
5193
5189
|
this.game.canvas.style.cursor = "pointer";
|
|
5194
5190
|
this._setHandCursor = true;
|
|
5195
5191
|
}
|
|
5196
|
-
if (!silent && sendEvent && this.sprite
|
|
5192
|
+
if (!silent && sendEvent && this.sprite !== null) this.sprite.events.onInputOver$dispatch(this.sprite, pointer);
|
|
5197
5193
|
if (this.sprite.parent && this.sprite.parent.type === 7) this.sprite.parent.onChildInputOver.dispatch(this.sprite, pointer);
|
|
5198
5194
|
}
|
|
5199
5195
|
}
|
|
@@ -5212,9 +5208,9 @@ var InputHandler = class {
|
|
|
5212
5208
|
this.game.canvas.style.cursor = "default";
|
|
5213
5209
|
this._setHandCursor = false;
|
|
5214
5210
|
}
|
|
5215
|
-
if (!silent && this.sprite
|
|
5211
|
+
if (!silent && this.sprite !== null) {
|
|
5216
5212
|
this.sprite.events.onInputOut$dispatch(this.sprite, pointer);
|
|
5217
|
-
if (this.sprite
|
|
5213
|
+
if (this.sprite?.parent?.type === 7) this.sprite.parent.onChildInputOut.dispatch(this.sprite, pointer);
|
|
5218
5214
|
}
|
|
5219
5215
|
}
|
|
5220
5216
|
/**
|
|
@@ -5231,9 +5227,9 @@ var InputHandler = class {
|
|
|
5231
5227
|
data.timeDown = this.game.time.time;
|
|
5232
5228
|
this.downPoint.setTo(pointer.x, pointer.y);
|
|
5233
5229
|
pointer.dirty = true;
|
|
5234
|
-
if (this.sprite
|
|
5230
|
+
if (this.sprite !== null) {
|
|
5235
5231
|
this.sprite.events.onInputDown$dispatch(this.sprite, pointer);
|
|
5236
|
-
if (this.sprite
|
|
5232
|
+
if (this.sprite?.parent?.type === 7) this.sprite.parent.onChildInputDown.dispatch(this.sprite, pointer);
|
|
5237
5233
|
if (this.sprite === null) return;
|
|
5238
5234
|
}
|
|
5239
5235
|
if (this.draggable && !this.isDragged) {
|
|
@@ -5255,7 +5251,7 @@ var InputHandler = class {
|
|
|
5255
5251
|
*/
|
|
5256
5252
|
dragTimeElapsed(pointer) {
|
|
5257
5253
|
this._dragTimePass = true;
|
|
5258
|
-
if (this._pendingDrag && this.sprite && this._dragDistancePass) this.startDrag(pointer);
|
|
5254
|
+
if (this._pendingDrag && this.sprite !== null && this._dragDistancePass) this.startDrag(pointer);
|
|
5259
5255
|
}
|
|
5260
5256
|
/**
|
|
5261
5257
|
* TBD.
|
|
@@ -5270,9 +5266,9 @@ var InputHandler = class {
|
|
|
5270
5266
|
data.timeUp = this.game.time.time;
|
|
5271
5267
|
data.downDuration = data.timeUp - data.timeDown;
|
|
5272
5268
|
let isOver = this.checkPointerOver(pointer);
|
|
5273
|
-
if (this.sprite
|
|
5269
|
+
if (this.sprite !== null) {
|
|
5274
5270
|
if (!this.dragStopBlocksInputUp || this.dragStopBlocksInputUp && !(this.draggable && this.isDragged && this._draggedPointerID === pointer.id)) this.sprite.events.onInputUp$dispatch(this.sprite, pointer, isOver);
|
|
5275
|
-
if (this.sprite
|
|
5271
|
+
if (this.sprite?.parent?.type === 7) this.sprite.parent.onChildInputUp.dispatch(this.sprite, pointer, isOver);
|
|
5276
5272
|
if (isOver) isOver = this.checkPointerOver(pointer);
|
|
5277
5273
|
}
|
|
5278
5274
|
data.isOver = isOver;
|
|
@@ -5389,7 +5385,7 @@ var InputHandler = class {
|
|
|
5389
5385
|
* TBD.
|
|
5390
5386
|
*/
|
|
5391
5387
|
disableDrag() {
|
|
5392
|
-
if (this._pointerData) for (let i = 0; i < 10; i += 1) this.pointerData(i).isDragged = false;
|
|
5388
|
+
if (this._pointerData.length > 0) for (let i = 0; i < 10; i += 1) this.pointerData(i).isDragged = false;
|
|
5393
5389
|
this.draggable = false;
|
|
5394
5390
|
this.isDragged = false;
|
|
5395
5391
|
this._draggedPointerID = -1;
|
|
@@ -5574,7 +5570,7 @@ var Button = class extends Image$1 {
|
|
|
5574
5570
|
this._onDownFrame = null;
|
|
5575
5571
|
this._onUpFrame = null;
|
|
5576
5572
|
this._onDisabledFrame = null;
|
|
5577
|
-
if (this.onInputOver) {
|
|
5573
|
+
if (this.onInputOver !== null) {
|
|
5578
5574
|
this.onInputOver.dispose();
|
|
5579
5575
|
this.onInputOut.dispose();
|
|
5580
5576
|
this.onInputDown.dispose();
|
|
@@ -5584,7 +5580,7 @@ var Button = class extends Image$1 {
|
|
|
5584
5580
|
this.onInputOut = null;
|
|
5585
5581
|
this.onInputDown = null;
|
|
5586
5582
|
this.onInputUp = null;
|
|
5587
|
-
if (this.input) this.input.destroy();
|
|
5583
|
+
if (this.input !== null) this.input.destroy();
|
|
5588
5584
|
this.input = null;
|
|
5589
5585
|
super.destroy();
|
|
5590
5586
|
}
|
|
@@ -5620,7 +5616,7 @@ var Button = class extends Image$1 {
|
|
|
5620
5616
|
*/
|
|
5621
5617
|
setStateFrame(state, frame, switchImmediately = false) {
|
|
5622
5618
|
const frameKey = `_on${state}Frame`;
|
|
5623
|
-
if (frame) {
|
|
5619
|
+
if (frame !== null) {
|
|
5624
5620
|
this[frameKey] = frame;
|
|
5625
5621
|
if (switchImmediately) this.changeStateFrame(state);
|
|
5626
5622
|
} else this[frameKey] = null;
|
|
@@ -5632,7 +5628,7 @@ var Button = class extends Image$1 {
|
|
|
5632
5628
|
*/
|
|
5633
5629
|
changeStateFrame(newState) {
|
|
5634
5630
|
if (this.freezeFrames) return false;
|
|
5635
|
-
const frameKey = `_on${this.input.enabled ||
|
|
5631
|
+
const frameKey = `_on${this.input.enabled || this._onDisabledFrame === null ? newState : STATE_DISABLED}Frame`;
|
|
5636
5632
|
const frame = this[frameKey];
|
|
5637
5633
|
if (typeof frame === "string") {
|
|
5638
5634
|
this.frameName = frame;
|
|
@@ -5656,7 +5652,7 @@ var Button = class extends Image$1 {
|
|
|
5656
5652
|
this.setStateFrame(STATE_OUT, outFrame, !this.input.pointerOver());
|
|
5657
5653
|
this.setStateFrame(STATE_DOWN, downFrame, this.input.pointerDown());
|
|
5658
5654
|
this.setStateFrame(STATE_UP, upFrame, this.input.pointerUp());
|
|
5659
|
-
if (disabledFrame) this.setStateFrame(STATE_DISABLED, disabledFrame, !this.input.enabled);
|
|
5655
|
+
if (disabledFrame !== null) this.setStateFrame(STATE_DISABLED, disabledFrame, !this.input.enabled);
|
|
5660
5656
|
}
|
|
5661
5657
|
/**
|
|
5662
5658
|
* Handles the input over event for this button.
|
|
@@ -5667,7 +5663,7 @@ var Button = class extends Image$1 {
|
|
|
5667
5663
|
if (pointer.justReleased() && (this.justReleasedPreventsOver & pointer.pointerMode) === pointer.pointerMode) return;
|
|
5668
5664
|
this.changeStateFrame(STATE_OVER);
|
|
5669
5665
|
if (this.onOverMouseOnly && !pointer.isMouse) return;
|
|
5670
|
-
if (this.onInputOver) this.onInputOver.dispatch(this, pointer);
|
|
5666
|
+
if (this.onInputOver !== null) this.onInputOver.dispatch(this, pointer);
|
|
5671
5667
|
}
|
|
5672
5668
|
/**
|
|
5673
5669
|
* Handles the input out event for this button.
|
|
@@ -5676,7 +5672,7 @@ var Button = class extends Image$1 {
|
|
|
5676
5672
|
*/
|
|
5677
5673
|
onInputOutHandler(_sprite, pointer) {
|
|
5678
5674
|
this.changeStateFrame(STATE_OUT);
|
|
5679
|
-
if (this.onInputOut) this.onInputOut.dispatch(this, pointer);
|
|
5675
|
+
if (this.onInputOut !== null) this.onInputOut.dispatch(this, pointer);
|
|
5680
5676
|
}
|
|
5681
5677
|
/**
|
|
5682
5678
|
* Handles the input down event for this button.
|
|
@@ -5685,7 +5681,7 @@ var Button = class extends Image$1 {
|
|
|
5685
5681
|
*/
|
|
5686
5682
|
onInputDownHandler(_sprite, pointer) {
|
|
5687
5683
|
this.changeStateFrame(STATE_DOWN);
|
|
5688
|
-
if (this.onInputDown) this.onInputDown.dispatch(this, pointer);
|
|
5684
|
+
if (this.onInputDown !== null) this.onInputDown.dispatch(this, pointer);
|
|
5689
5685
|
}
|
|
5690
5686
|
/**
|
|
5691
5687
|
* Handles the input up event for this button.
|
|
@@ -5694,7 +5690,7 @@ var Button = class extends Image$1 {
|
|
|
5694
5690
|
* @param {boolean} isOver - Whether the pointer is currently over the button (default: true).
|
|
5695
5691
|
*/
|
|
5696
5692
|
onInputUpHandler(_sprite, pointer, isOver) {
|
|
5697
|
-
if (this.onInputUp) this.onInputUp.dispatch(this, pointer, isOver);
|
|
5693
|
+
if (this.onInputUp !== null) this.onInputUp.dispatch(this, pointer, isOver);
|
|
5698
5694
|
if (this.freezeFrames) return;
|
|
5699
5695
|
const forcedOutMode = typeof this.forceOut === "number" ? this.forceOut : 0;
|
|
5700
5696
|
if (this.forceOut === true || (forcedOutMode & pointer.pointerMode) === pointer.pointerMode) this.changeStateFrame(STATE_OUT);
|
|
@@ -5708,7 +5704,7 @@ var Button = class extends Image$1 {
|
|
|
5708
5704
|
* @returns {boolean} True if input is enabled, false otherwise.
|
|
5709
5705
|
*/
|
|
5710
5706
|
get inputEnabled() {
|
|
5711
|
-
return this.input && this.input.enabled;
|
|
5707
|
+
return this.input !== null && this.input.enabled;
|
|
5712
5708
|
}
|
|
5713
5709
|
/**
|
|
5714
5710
|
* Sets whether input is currently enabled for this button.
|
|
@@ -5719,8 +5715,8 @@ var Button = class extends Image$1 {
|
|
|
5719
5715
|
if (this.input === null) {
|
|
5720
5716
|
this.input = new InputHandler(this);
|
|
5721
5717
|
this.input.start();
|
|
5722
|
-
} else if (this.input && !this.input.enabled) this.input.start();
|
|
5723
|
-
} else if (this.input && this.input.enabled) this.input.stop();
|
|
5718
|
+
} else if (this.input !== null && !this.input.enabled) this.input.start();
|
|
5719
|
+
} else if (this.input !== null && this.input.enabled) this.input.stop();
|
|
5724
5720
|
}
|
|
5725
5721
|
};
|
|
5726
5722
|
//#endregion
|
|
@@ -5759,9 +5755,9 @@ const contains$1 = (a, x, y) => {
|
|
|
5759
5755
|
*/
|
|
5760
5756
|
const circumferencePoint = (a, angle, asDegrees = false, output = null) => {
|
|
5761
5757
|
const result = output ?? new Point();
|
|
5762
|
-
|
|
5763
|
-
result.x = a.x + a.radius * Math.cos(
|
|
5764
|
-
result.y = a.y + a.radius * Math.sin(
|
|
5758
|
+
const radians = asDegrees ? degToRad(angle) : angle;
|
|
5759
|
+
result.x = a.x + a.radius * Math.cos(radians);
|
|
5760
|
+
result.y = a.y + a.radius * Math.sin(radians);
|
|
5765
5761
|
return result;
|
|
5766
5762
|
};
|
|
5767
5763
|
//#endregion
|
|
@@ -6187,7 +6183,7 @@ var Polygon = class {
|
|
|
6187
6183
|
this.flattened = false;
|
|
6188
6184
|
/** @type {number} */
|
|
6189
6185
|
this.type = 12;
|
|
6190
|
-
if (points) this.setTo(points);
|
|
6186
|
+
if (points !== null) this.setTo(points);
|
|
6191
6187
|
}
|
|
6192
6188
|
/**
|
|
6193
6189
|
* Converts the polygon's points to a number array.
|
|
@@ -6257,7 +6253,7 @@ var Polygon = class {
|
|
|
6257
6253
|
this.area = 0;
|
|
6258
6254
|
const vertices = [];
|
|
6259
6255
|
this._points = vertices;
|
|
6260
|
-
if (points) {
|
|
6256
|
+
if (points.length > 0) {
|
|
6261
6257
|
if (!Array.isArray(points)) console.error("[Polygon] setTo() error, input parameter is not an array", points);
|
|
6262
6258
|
let y0 = Number.MAX_VALUE;
|
|
6263
6259
|
for (let i = 0, len = points.length; i < len; i += 1) {
|
|
@@ -6469,7 +6465,7 @@ const renderGraphics$1 = (graphics, context) => {
|
|
|
6469
6465
|
context.stroke();
|
|
6470
6466
|
}
|
|
6471
6467
|
} else if (shape instanceof Rectangle) {
|
|
6472
|
-
if (data.fillColor
|
|
6468
|
+
if (data.fillColor !== null) {
|
|
6473
6469
|
context.globalAlpha = data.fillAlpha * worldAlpha;
|
|
6474
6470
|
context.fillStyle = `#${`00000${Math.trunc(fillColor ?? 0).toString(16)}`.slice(-6)}`;
|
|
6475
6471
|
context.fillRect(shape.x, shape.y, shape.width, shape.height);
|
|
@@ -6541,7 +6537,7 @@ const renderGraphics$1 = (graphics, context) => {
|
|
|
6541
6537
|
context.lineTo(rx + radius, ry);
|
|
6542
6538
|
context.quadraticCurveTo(rx, ry, rx, ry + radius);
|
|
6543
6539
|
context.closePath();
|
|
6544
|
-
if (data.fillColor
|
|
6540
|
+
if (data.fillColor !== null) {
|
|
6545
6541
|
context.globalAlpha = data.fillAlpha * worldAlpha;
|
|
6546
6542
|
context.fillStyle = `#${`00000${Math.trunc(fillColor ?? 0).toString(16)}`.slice(-6)}`;
|
|
6547
6543
|
context.fill();
|
|
@@ -6708,10 +6704,11 @@ var Node = class {
|
|
|
6708
6704
|
function sortLinked(list) {
|
|
6709
6705
|
let numMerges;
|
|
6710
6706
|
let inSize = 1;
|
|
6707
|
+
let sorted = list;
|
|
6711
6708
|
do {
|
|
6712
|
-
let p =
|
|
6709
|
+
let p = sorted;
|
|
6713
6710
|
let tail = null;
|
|
6714
|
-
|
|
6711
|
+
sorted = null;
|
|
6715
6712
|
numMerges = 0;
|
|
6716
6713
|
while (p) {
|
|
6717
6714
|
numMerges += 1;
|
|
@@ -6745,7 +6742,7 @@ function sortLinked(list) {
|
|
|
6745
6742
|
qSize -= 1;
|
|
6746
6743
|
}
|
|
6747
6744
|
if (tail) tail.nextZ = e;
|
|
6748
|
-
else
|
|
6745
|
+
else sorted = e;
|
|
6749
6746
|
e.prevZ = tail;
|
|
6750
6747
|
tail = e;
|
|
6751
6748
|
}
|
|
@@ -6754,7 +6751,7 @@ function sortLinked(list) {
|
|
|
6754
6751
|
if (tail) tail.nextZ = null;
|
|
6755
6752
|
inSize *= 2;
|
|
6756
6753
|
} while (numMerges > 1);
|
|
6757
|
-
return
|
|
6754
|
+
return sorted;
|
|
6758
6755
|
}
|
|
6759
6756
|
/**
|
|
6760
6757
|
* Calculates the area of a triangle defined by three points.
|
|
@@ -6775,17 +6772,17 @@ function compareX(a, b) {
|
|
|
6775
6772
|
* @returns {number} The calculated distance from the point to the triangle edge.
|
|
6776
6773
|
*/
|
|
6777
6774
|
function zOrder(x, y, minX, minY, size) {
|
|
6778
|
-
|
|
6779
|
-
|
|
6780
|
-
|
|
6781
|
-
|
|
6782
|
-
|
|
6783
|
-
|
|
6784
|
-
|
|
6785
|
-
|
|
6786
|
-
|
|
6787
|
-
|
|
6788
|
-
return
|
|
6775
|
+
let ix = 32767 * (x - minX) / size;
|
|
6776
|
+
let iy = 32767 * (y - minY) / size;
|
|
6777
|
+
ix = (ix | ix << 8) & 16711935;
|
|
6778
|
+
ix = (ix | ix << 4) & 252645135;
|
|
6779
|
+
ix = (ix | ix << 2) & 858993459;
|
|
6780
|
+
ix = (ix | ix << 1) & 1431655765;
|
|
6781
|
+
iy = (iy | iy << 8) & 16711935;
|
|
6782
|
+
iy = (iy | iy << 4) & 252645135;
|
|
6783
|
+
iy = (iy | iy << 2) & 858993459;
|
|
6784
|
+
iy = (iy | iy << 1) & 1431655765;
|
|
6785
|
+
return ix | iy << 1;
|
|
6789
6786
|
}
|
|
6790
6787
|
/**
|
|
6791
6788
|
* Calculates the orientation of three points (clockwise, counterclockwise, or collinear).
|
|
@@ -7044,7 +7041,7 @@ function linkedList(data, start, end, dim, clockwise) {
|
|
|
7044
7041
|
*/
|
|
7045
7042
|
function filterPoints(start, end) {
|
|
7046
7043
|
if (!start) return start;
|
|
7047
|
-
end
|
|
7044
|
+
let last = end ?? start;
|
|
7048
7045
|
let p = start;
|
|
7049
7046
|
let again;
|
|
7050
7047
|
do {
|
|
@@ -7052,12 +7049,12 @@ function filterPoints(start, end) {
|
|
|
7052
7049
|
if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {
|
|
7053
7050
|
removeNode(p);
|
|
7054
7051
|
p = p.prev;
|
|
7055
|
-
|
|
7052
|
+
last = p;
|
|
7056
7053
|
if (p === p.next) return null;
|
|
7057
7054
|
again = true;
|
|
7058
7055
|
} else p = p.next;
|
|
7059
|
-
} while (again || p !==
|
|
7060
|
-
return
|
|
7056
|
+
} while (again || p !== last);
|
|
7057
|
+
return last;
|
|
7061
7058
|
}
|
|
7062
7059
|
/**
|
|
7063
7060
|
* Calculates the minimum and maximum coordinates of a set of points.
|
|
@@ -7135,12 +7132,13 @@ function eliminateHoles(data, holeIndices, outerNode, dim) {
|
|
|
7135
7132
|
queue.push(getLeftmost(list));
|
|
7136
7133
|
}
|
|
7137
7134
|
queue.sort(compareX);
|
|
7135
|
+
let outer = outerNode;
|
|
7138
7136
|
for (i = 0; i < queue.length; i += 1) {
|
|
7139
|
-
if (!
|
|
7140
|
-
eliminateHole(queue[i],
|
|
7141
|
-
|
|
7137
|
+
if (!outer) return outer;
|
|
7138
|
+
eliminateHole(queue[i], outer);
|
|
7139
|
+
outer = filterPoints(outer, outer.next);
|
|
7142
7140
|
}
|
|
7143
|
-
return
|
|
7141
|
+
return outer;
|
|
7144
7142
|
}
|
|
7145
7143
|
/**
|
|
7146
7144
|
* Calculates the centroid of a polygon.
|
|
@@ -7151,6 +7149,7 @@ function eliminateHoles(data, holeIndices, outerNode, dim) {
|
|
|
7151
7149
|
*/
|
|
7152
7150
|
function cureLocalIntersections(start, triangles, dim) {
|
|
7153
7151
|
let p = start;
|
|
7152
|
+
let first = start;
|
|
7154
7153
|
do {
|
|
7155
7154
|
const a = p.prev;
|
|
7156
7155
|
const b = p.next.next;
|
|
@@ -7161,10 +7160,10 @@ function cureLocalIntersections(start, triangles, dim) {
|
|
|
7161
7160
|
removeNode(p);
|
|
7162
7161
|
removeNode(p.next);
|
|
7163
7162
|
p = b;
|
|
7164
|
-
|
|
7163
|
+
first = p;
|
|
7165
7164
|
}
|
|
7166
7165
|
p = p.next;
|
|
7167
|
-
} while (p !==
|
|
7166
|
+
} while (p !== first);
|
|
7168
7167
|
return p;
|
|
7169
7168
|
}
|
|
7170
7169
|
/**
|
|
@@ -7206,28 +7205,29 @@ function splitEarcut(start, triangles, dim, minX = 0, minY = 0, size = 0) {
|
|
|
7206
7205
|
*/
|
|
7207
7206
|
function earcutLinked(ear, triangles, dim, minX, minY, size, pass) {
|
|
7208
7207
|
if (!ear) return;
|
|
7209
|
-
|
|
7210
|
-
|
|
7208
|
+
let current = ear;
|
|
7209
|
+
if (pass === void 0 && size !== void 0) indexCurve(current, minX, minY, size);
|
|
7210
|
+
let stop = current;
|
|
7211
7211
|
let prev;
|
|
7212
7212
|
let next;
|
|
7213
|
-
while (
|
|
7214
|
-
({prev, next} =
|
|
7215
|
-
if (size ? isEarHashed(
|
|
7213
|
+
while (current.prev !== current.next) {
|
|
7214
|
+
({prev, next} = current);
|
|
7215
|
+
if (size === void 0 ? isEar(current) : isEarHashed(current, minX, minY, size)) {
|
|
7216
7216
|
triangles.push(prev.i / dim);
|
|
7217
|
-
triangles.push(
|
|
7217
|
+
triangles.push(current.i / dim);
|
|
7218
7218
|
triangles.push(next.i / dim);
|
|
7219
|
-
removeNode(
|
|
7220
|
-
|
|
7219
|
+
removeNode(current);
|
|
7220
|
+
current = next.next;
|
|
7221
7221
|
stop = next.next;
|
|
7222
7222
|
continue;
|
|
7223
7223
|
}
|
|
7224
|
-
|
|
7225
|
-
if (
|
|
7226
|
-
if (
|
|
7224
|
+
current = next;
|
|
7225
|
+
if (current === stop) {
|
|
7226
|
+
if (pass === void 0) earcutLinked(filterPoints(current), triangles, dim, minX, minY, size, 1);
|
|
7227
7227
|
else if (pass === 1) {
|
|
7228
|
-
|
|
7229
|
-
earcutLinked(
|
|
7230
|
-
} else if (pass === 2) splitEarcut(
|
|
7228
|
+
current = cureLocalIntersections(current, triangles, dim);
|
|
7229
|
+
earcutLinked(current, triangles, dim, minX, minY, size, 2);
|
|
7230
|
+
} else if (pass === 2) splitEarcut(current, triangles, dim, minX, minY, size);
|
|
7231
7231
|
break;
|
|
7232
7232
|
}
|
|
7233
7233
|
}
|
|
@@ -7737,7 +7737,7 @@ const buildPoly = (graphicsData, webGLData) => {
|
|
|
7737
7737
|
const g = color[1] * alpha;
|
|
7738
7738
|
const b = color[2] * alpha;
|
|
7739
7739
|
const triangles = triangulate(points, null, 2);
|
|
7740
|
-
if (
|
|
7740
|
+
if (triangles.length === 0) return false;
|
|
7741
7741
|
const vertPos = verts.length / 6;
|
|
7742
7742
|
for (let i = 0; i < triangles.length; i += 3) {
|
|
7743
7743
|
indices.push(triangles[i] + vertPos);
|
|
@@ -8206,13 +8206,14 @@ var Graphics = class extends DisplayObject {
|
|
|
8206
8206
|
*/
|
|
8207
8207
|
arc(cx, cy, radius, startAngle, endAngle, anticlockwise = false, segments = 40) {
|
|
8208
8208
|
if (startAngle === endAngle) return this;
|
|
8209
|
-
|
|
8210
|
-
|
|
8211
|
-
const
|
|
8209
|
+
const fullTurn = Math.PI * 2;
|
|
8210
|
+
const from = anticlockwise && startAngle <= endAngle ? startAngle + fullTurn : startAngle;
|
|
8211
|
+
const to = !anticlockwise && endAngle <= startAngle ? endAngle + fullTurn : endAngle;
|
|
8212
|
+
const sweep = anticlockwise ? (from - to) * -1 : to - from;
|
|
8212
8213
|
const segs = Math.ceil(Math.abs(sweep) / (Math.PI * 2)) * segments;
|
|
8213
8214
|
if (sweep === 0) return this;
|
|
8214
|
-
const startX = cx + Math.cos(
|
|
8215
|
-
const startY = cy + Math.sin(
|
|
8215
|
+
const startX = cx + Math.cos(from) * radius;
|
|
8216
|
+
const startY = cy + Math.sin(from) * radius;
|
|
8216
8217
|
if (anticlockwise && this.filling) this.moveTo(cx, cy);
|
|
8217
8218
|
else this.moveTo(startX, startY);
|
|
8218
8219
|
const { points } = this.currentPath.shape;
|
|
@@ -8224,7 +8225,7 @@ var Graphics = class extends DisplayObject {
|
|
|
8224
8225
|
const remainder = segMinus % 1 / segMinus;
|
|
8225
8226
|
for (let i = 0; i <= segMinus; i += 1) {
|
|
8226
8227
|
const real = i + remainder * i;
|
|
8227
|
-
const angle = theta +
|
|
8228
|
+
const angle = theta + from + theta2 * real;
|
|
8228
8229
|
const c = Math.cos(angle);
|
|
8229
8230
|
const s = -Math.sin(angle);
|
|
8230
8231
|
points.push((cTheta * c + sTheta * s) * radius + cx, (cTheta * -s + sTheta * c) * radius + cy);
|
|
@@ -8662,7 +8663,7 @@ var Graphics = class extends DisplayObject {
|
|
|
8662
8663
|
drawTriangles(vertices, indices, cull = false) {
|
|
8663
8664
|
let points = [];
|
|
8664
8665
|
let i;
|
|
8665
|
-
if (
|
|
8666
|
+
if (indices === null) {
|
|
8666
8667
|
if (vertices[0] instanceof Point) {
|
|
8667
8668
|
const corners = vertices;
|
|
8668
8669
|
for (i = 0; i < corners.length / 3; i += 1) this.drawTriangle([
|
|
@@ -8726,7 +8727,7 @@ var Group = class extends DisplayObject {
|
|
|
8726
8727
|
super(game);
|
|
8727
8728
|
/** @type {number} */
|
|
8728
8729
|
this.type = 7;
|
|
8729
|
-
parent
|
|
8730
|
+
const target = parent ?? game.world;
|
|
8730
8731
|
/** @type {string} */
|
|
8731
8732
|
this.name = name ?? "group";
|
|
8732
8733
|
/** @type {number} */
|
|
@@ -8734,9 +8735,9 @@ var Group = class extends DisplayObject {
|
|
|
8734
8735
|
if (addToStage) {
|
|
8735
8736
|
this.game.stage.addChild(this);
|
|
8736
8737
|
this.z = this.game.stage.children.length;
|
|
8737
|
-
} else if (
|
|
8738
|
-
|
|
8739
|
-
this.z =
|
|
8738
|
+
} else if (target) {
|
|
8739
|
+
target.addChild(this);
|
|
8740
|
+
this.z = target.children.length;
|
|
8740
8741
|
}
|
|
8741
8742
|
/** @type {boolean} */
|
|
8742
8743
|
this.ignoreDestroy = false;
|
|
@@ -8797,7 +8798,7 @@ var Group = class extends DisplayObject {
|
|
|
8797
8798
|
this.updateZ();
|
|
8798
8799
|
}
|
|
8799
8800
|
const inputChild = child;
|
|
8800
|
-
if (this.inputEnableChildren && (
|
|
8801
|
+
if (this.inputEnableChildren && (inputChild.input === void 0 || inputChild.inputEnabled === true)) inputChild.inputEnabled = true;
|
|
8801
8802
|
if (!silent && child.events) child.events.onAddedToGroup$dispatch(child, this);
|
|
8802
8803
|
this.cursor ??= child;
|
|
8803
8804
|
return child;
|
|
@@ -8912,7 +8913,7 @@ var Group = class extends DisplayObject {
|
|
|
8912
8913
|
this.destroy();
|
|
8913
8914
|
return;
|
|
8914
8915
|
}
|
|
8915
|
-
if (!this.exists ||
|
|
8916
|
+
if (!this.exists || this.parent?.exists !== true) {
|
|
8916
8917
|
this.renderOrderID = -1;
|
|
8917
8918
|
return;
|
|
8918
8919
|
}
|
|
@@ -9092,10 +9093,10 @@ var Text = class extends Image$1 {
|
|
|
9092
9093
|
tabs: source.tabs ?? 0
|
|
9093
9094
|
};
|
|
9094
9095
|
const components = this.fontToComponents(resolved.font);
|
|
9095
|
-
if (resolved.fontStyle) components.fontStyle = resolved.fontStyle;
|
|
9096
|
-
if (resolved.fontVariant) components.fontVariant = resolved.fontVariant;
|
|
9097
|
-
if (resolved.fontWeight) components.fontWeight = String(resolved.fontWeight);
|
|
9098
|
-
if (resolved.fontSize) {
|
|
9096
|
+
if (resolved.fontStyle !== void 0 && resolved.fontStyle !== "") components.fontStyle = resolved.fontStyle;
|
|
9097
|
+
if (resolved.fontVariant !== void 0 && resolved.fontVariant !== "") components.fontVariant = resolved.fontVariant;
|
|
9098
|
+
if (resolved.fontWeight !== void 0 && resolved.fontWeight !== "") components.fontWeight = String(resolved.fontWeight);
|
|
9099
|
+
if (resolved.fontSize !== void 0 && resolved.fontSize !== "") {
|
|
9099
9100
|
const fontSize = typeof resolved.fontSize === "number" ? `${resolved.fontSize}px` : resolved.fontSize;
|
|
9100
9101
|
resolved.fontSize = fontSize;
|
|
9101
9102
|
components.fontSize = fontSize;
|
|
@@ -9157,7 +9158,7 @@ var Text = class extends Image$1 {
|
|
|
9157
9158
|
if (lineSpacing !== 0) height += lineSpacing > 0 ? lineSpacing * lines.length : lineSpacing * (lines.length - 1);
|
|
9158
9159
|
this.canvas.height = height * this._res;
|
|
9159
9160
|
this.context.scale(this._res, this._res);
|
|
9160
|
-
if (this.style.backgroundColor) {
|
|
9161
|
+
if (this.style.backgroundColor !== null && this.style.backgroundColor !== "") {
|
|
9161
9162
|
this.context.fillStyle = this.style.backgroundColor;
|
|
9162
9163
|
this.context.fillRect(0, 0, this.canvas.width, this.canvas.height);
|
|
9163
9164
|
}
|
|
@@ -9218,12 +9219,15 @@ var Text = class extends Image$1 {
|
|
|
9218
9219
|
if (fill) this.context.fillText(text[c], snap, y);
|
|
9219
9220
|
else this.context.strokeText(text[c], snap, y);
|
|
9220
9221
|
}
|
|
9221
|
-
} else
|
|
9222
|
-
|
|
9223
|
-
|
|
9224
|
-
|
|
9225
|
-
|
|
9226
|
-
|
|
9222
|
+
} else {
|
|
9223
|
+
let cursor = x;
|
|
9224
|
+
for (const part of text) {
|
|
9225
|
+
const section = Math.ceil(this.context.measureText(part).width);
|
|
9226
|
+
snap = snapToCeil(cursor, tabs);
|
|
9227
|
+
if (fill) this.context.fillText(part, snap, y);
|
|
9228
|
+
else this.context.strokeText(part, snap, y);
|
|
9229
|
+
cursor = snap + section;
|
|
9230
|
+
}
|
|
9227
9231
|
}
|
|
9228
9232
|
}
|
|
9229
9233
|
/**
|
|
@@ -9262,18 +9266,18 @@ var Text = class extends Image$1 {
|
|
|
9262
9266
|
const components = this.fontToComponents(this.context.font);
|
|
9263
9267
|
const charFontStyle = this.fontStyles[this._charCount];
|
|
9264
9268
|
const charFontWeight = this.fontWeights[this._charCount];
|
|
9265
|
-
if (charFontStyle) components.fontStyle = charFontStyle;
|
|
9266
|
-
if (charFontWeight) components.fontWeight = charFontWeight;
|
|
9269
|
+
if (charFontStyle !== void 0 && charFontStyle !== null && charFontStyle !== "") components.fontStyle = charFontStyle;
|
|
9270
|
+
if (charFontWeight !== void 0 && charFontWeight !== null && charFontWeight !== "") components.fontWeight = charFontWeight;
|
|
9267
9271
|
this.context.font = this.componentsToFont(components);
|
|
9268
9272
|
}
|
|
9269
9273
|
if (this.style.stroke && this.style.strokeThickness) {
|
|
9270
9274
|
const charStrokeColor = this.strokeColors[this._charCount];
|
|
9271
|
-
if (charStrokeColor) this.context.strokeStyle = charStrokeColor;
|
|
9275
|
+
if (charStrokeColor !== void 0 && charStrokeColor !== null && charStrokeColor !== "") this.context.strokeStyle = charStrokeColor;
|
|
9272
9276
|
this.updateShadow(this.style.shadowStroke ?? false);
|
|
9273
9277
|
}
|
|
9274
9278
|
if (this.style.fill) {
|
|
9275
9279
|
const charFillColor = this.colors[this._charCount];
|
|
9276
|
-
if (charFillColor) this.context.fillStyle = charFillColor;
|
|
9280
|
+
if (charFillColor !== void 0 && charFillColor !== null && charFillColor !== "") this.context.fillStyle = charFillColor;
|
|
9277
9281
|
this.updateShadow(this.style.shadowFill ?? false);
|
|
9278
9282
|
}
|
|
9279
9283
|
lineLength += this.context.measureText(letter).width;
|
|
@@ -9288,28 +9292,29 @@ var Text = class extends Image$1 {
|
|
|
9288
9292
|
* @param {number} y - The y position to start updating from.
|
|
9289
9293
|
*/
|
|
9290
9294
|
updateLine(line, x, y) {
|
|
9295
|
+
let cursor = x;
|
|
9291
9296
|
for (const letter of line) {
|
|
9292
9297
|
if (this.fontWeights.length > 0 || this.fontStyles.length > 0) {
|
|
9293
9298
|
const components = this.fontToComponents(this.context.font);
|
|
9294
9299
|
const charFontStyle = this.fontStyles[this._charCount];
|
|
9295
9300
|
const charFontWeight = this.fontWeights[this._charCount];
|
|
9296
|
-
if (charFontStyle) components.fontStyle = charFontStyle;
|
|
9297
|
-
if (charFontWeight) components.fontWeight = charFontWeight;
|
|
9301
|
+
if (charFontStyle !== void 0 && charFontStyle !== null && charFontStyle !== "") components.fontStyle = charFontStyle;
|
|
9302
|
+
if (charFontWeight !== void 0 && charFontWeight !== null && charFontWeight !== "") components.fontWeight = charFontWeight;
|
|
9298
9303
|
this.context.font = this.componentsToFont(components);
|
|
9299
9304
|
}
|
|
9300
9305
|
if (this.style.stroke && this.style.strokeThickness) {
|
|
9301
9306
|
const charStrokeColor = this.strokeColors[this._charCount];
|
|
9302
|
-
if (charStrokeColor) this.context.strokeStyle = charStrokeColor;
|
|
9307
|
+
if (charStrokeColor !== void 0 && charStrokeColor !== null && charStrokeColor !== "") this.context.strokeStyle = charStrokeColor;
|
|
9303
9308
|
this.updateShadow(this.style.shadowStroke ?? false);
|
|
9304
|
-
this.context.strokeText(letter,
|
|
9309
|
+
this.context.strokeText(letter, cursor, y);
|
|
9305
9310
|
}
|
|
9306
9311
|
if (this.style.fill) {
|
|
9307
9312
|
const charFillColor = this.colors[this._charCount];
|
|
9308
|
-
if (charFillColor) this.context.fillStyle = charFillColor;
|
|
9313
|
+
if (charFillColor !== void 0 && charFillColor !== null && charFillColor !== "") this.context.fillStyle = charFillColor;
|
|
9309
9314
|
this.updateShadow(this.style.shadowFill ?? false);
|
|
9310
|
-
this.context.fillText(letter,
|
|
9315
|
+
this.context.fillText(letter, cursor, y);
|
|
9311
9316
|
}
|
|
9312
|
-
|
|
9317
|
+
cursor += this.context.measureText(letter).width;
|
|
9313
9318
|
this._charCount += 1;
|
|
9314
9319
|
}
|
|
9315
9320
|
}
|
|
@@ -9517,18 +9522,15 @@ var Text = class extends Image$1 {
|
|
|
9517
9522
|
*/
|
|
9518
9523
|
componentsToFont(components) {
|
|
9519
9524
|
const parts = [];
|
|
9520
|
-
|
|
9521
|
-
|
|
9522
|
-
|
|
9523
|
-
|
|
9524
|
-
|
|
9525
|
-
|
|
9526
|
-
|
|
9527
|
-
|
|
9528
|
-
if (
|
|
9529
|
-
v = components.fontFamily;
|
|
9530
|
-
if (v) parts.push(v);
|
|
9531
|
-
if (parts.length === 0) parts.push(components.font);
|
|
9525
|
+
const push = (value, skip) => {
|
|
9526
|
+
if (value !== void 0 && value !== "" && value !== skip) parts.push(String(value));
|
|
9527
|
+
};
|
|
9528
|
+
push(components.fontStyle, "normal");
|
|
9529
|
+
push(components.fontVariant, "normal");
|
|
9530
|
+
push(components.fontWeight, "normal");
|
|
9531
|
+
push(components.fontSize, "medium");
|
|
9532
|
+
push(components.fontFamily, "");
|
|
9533
|
+
if (parts.length === 0) parts.push(components.font ?? "");
|
|
9532
9534
|
return parts.join(" ");
|
|
9533
9535
|
}
|
|
9534
9536
|
/**
|
|
@@ -9659,7 +9661,7 @@ var Text = class extends Image$1 {
|
|
|
9659
9661
|
* @returns {CanvasRenderingContext2D} The font properties canvas context.
|
|
9660
9662
|
*/
|
|
9661
9663
|
getFontPropertiesContext() {
|
|
9662
|
-
if (
|
|
9664
|
+
if (globalThis.PhaserRegistry.fontPropertiesContext === void 0) {
|
|
9663
9665
|
const context = this.getFontPropertiesCanvas().getContext("2d", { willReadFrequently: true });
|
|
9664
9666
|
if (!context) throw new Error(ENGINE_ERROR_CREATING_CANVAS_2D_CONTEXT);
|
|
9665
9667
|
globalThis.PhaserRegistry.fontPropertiesContext = context;
|
|
@@ -9708,7 +9710,7 @@ var Text = class extends Image$1 {
|
|
|
9708
9710
|
context.textBaseline = "alphabetic";
|
|
9709
9711
|
context.fillStyle = "#000";
|
|
9710
9712
|
context.fillText("|MÉq", 0, baseline);
|
|
9711
|
-
if (
|
|
9713
|
+
if (context.getImageData(0, 0, width, height) === null) {
|
|
9712
9714
|
const fallback = {
|
|
9713
9715
|
ascent: baseline,
|
|
9714
9716
|
descent: baseline + 6,
|
|
@@ -9824,7 +9826,7 @@ var Text = class extends Image$1 {
|
|
|
9824
9826
|
get fontSize() {
|
|
9825
9827
|
const size = this._fontComponents.fontSize;
|
|
9826
9828
|
if (typeof size === "number") return size;
|
|
9827
|
-
if (size && /(?:^0$|px$)/.exec(size)) return Number.parseInt(size, 10);
|
|
9829
|
+
if (size !== void 0 && size !== "" && /(?:^0$|px$)/.exec(size)) return Number.parseInt(size, 10);
|
|
9828
9830
|
return 0;
|
|
9829
9831
|
}
|
|
9830
9832
|
/**
|
|
@@ -10418,7 +10420,7 @@ var CanvasRenderer = class {
|
|
|
10418
10420
|
this.view.style.width = `${this.width / this.resolution}px`;
|
|
10419
10421
|
this.view.style.height = `${this.height / this.resolution}px`;
|
|
10420
10422
|
}
|
|
10421
|
-
if (this.renderSession.smoothProperty) setSmoothing(this.context, this.renderSession.smoothProperty, this.renderSession.scaleMode === 0);
|
|
10423
|
+
if (this.renderSession.smoothProperty !== null) setSmoothing(this.context, this.renderSession.smoothProperty, this.renderSession.scaleMode === 0);
|
|
10422
10424
|
}
|
|
10423
10425
|
/**
|
|
10424
10426
|
* Renders a display object to canvas.
|
|
@@ -10618,7 +10620,7 @@ const compileShader = (gl, shaderSrc, shaderType) => {
|
|
|
10618
10620
|
if (!shader) return null;
|
|
10619
10621
|
gl.shaderSource(shader, src);
|
|
10620
10622
|
gl.compileShader(shader);
|
|
10621
|
-
if (
|
|
10623
|
+
if (gl.getShaderParameter(shader, gl.COMPILE_STATUS) !== true) {
|
|
10622
10624
|
getRegistry();
|
|
10623
10625
|
globalThis.PhaserRegistry.GL_SHADER_INFO_LOG = gl.getShaderInfoLog(shader);
|
|
10624
10626
|
return null;
|
|
@@ -10650,11 +10652,11 @@ const compileProgram = (gl, vertexSrc, fragmentSrc) => {
|
|
|
10650
10652
|
const fragmentShader = compileFragmentShader(gl, fragmentSrc);
|
|
10651
10653
|
const vertexShader = compileVertexShader(gl, vertexSrc);
|
|
10652
10654
|
const shaderProgram = gl.createProgram();
|
|
10653
|
-
if (
|
|
10655
|
+
if (shaderProgram === null || vertexShader === null || fragmentShader === null) return null;
|
|
10654
10656
|
gl.attachShader(shaderProgram, vertexShader);
|
|
10655
10657
|
gl.attachShader(shaderProgram, fragmentShader);
|
|
10656
10658
|
gl.linkProgram(shaderProgram);
|
|
10657
|
-
if (
|
|
10659
|
+
if (gl.getProgramParameter(shaderProgram, gl.LINK_STATUS) !== true) {
|
|
10658
10660
|
getRegistry();
|
|
10659
10661
|
globalThis.PhaserRegistry.GL_PROGRAM_INFO_LOG = gl.getProgramInfoLog(shaderProgram);
|
|
10660
10662
|
}
|
|
@@ -10976,7 +10978,7 @@ var NormalShader = class {
|
|
|
10976
10978
|
*/
|
|
10977
10979
|
initSampler2D(uniform) {
|
|
10978
10980
|
const texture = uniform.value;
|
|
10979
|
-
if (
|
|
10981
|
+
if (texture?.baseTexture.hasLoaded !== true) return;
|
|
10980
10982
|
const { gl } = this;
|
|
10981
10983
|
gl.activeTexture(glMember(gl, `TEXTURE${this.textureCount}`));
|
|
10982
10984
|
gl.bindTexture(gl.TEXTURE_2D, texture.baseTexture._glTextures[gl.id] ?? null);
|
|
@@ -10986,13 +10988,13 @@ var NormalShader = class {
|
|
|
10986
10988
|
const minFilter = data.minFilter ?? gl.LINEAR;
|
|
10987
10989
|
let wrapS = data.wrapS ?? gl.CLAMP_TO_EDGE;
|
|
10988
10990
|
let wrapT = data.wrapT ?? gl.CLAMP_TO_EDGE;
|
|
10989
|
-
const format = data.luminance ? gl.LUMINANCE : gl.RGBA;
|
|
10990
|
-
if (data.repeat) {
|
|
10991
|
+
const format = data.luminance === true ? gl.LUMINANCE : gl.RGBA;
|
|
10992
|
+
if (data.repeat === true) {
|
|
10991
10993
|
wrapS = gl.REPEAT;
|
|
10992
10994
|
wrapT = gl.REPEAT;
|
|
10993
10995
|
}
|
|
10994
10996
|
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, Boolean(data.flipY));
|
|
10995
|
-
if (data.width) {
|
|
10997
|
+
if (data.width !== void 0) {
|
|
10996
10998
|
const width = data.width ?? 512;
|
|
10997
10999
|
const height = data.height ?? 2;
|
|
10998
11000
|
const border = data.border ?? 0;
|
|
@@ -11023,10 +11025,10 @@ var NormalShader = class {
|
|
|
11023
11025
|
else if (uniform.glValueLength === 3) callUniformSetter(uniform.glFunc, gl, uniform.uniformLocation, vector.x, vector.y, vector.z);
|
|
11024
11026
|
else if (uniform.glValueLength === 4) callUniformSetter(uniform.glFunc, gl, uniform.uniformLocation, vector.x, vector.y, vector.z, vector.w);
|
|
11025
11027
|
else if (uniform.type === "sampler2D") {
|
|
11026
|
-
if (uniform._init) {
|
|
11028
|
+
if (uniform._init === true) {
|
|
11027
11029
|
gl.activeTexture(glMember(gl, `TEXTURE${this.textureCount}`));
|
|
11028
11030
|
const { baseTexture } = sampler.value;
|
|
11029
|
-
if (baseTexture._dirty[gl.id]) globalThis.PhaserRegistry.INSTANCES[gl.id]?.updateTexture(baseTexture);
|
|
11031
|
+
if (baseTexture._dirty[gl.id] === true) globalThis.PhaserRegistry.INSTANCES[gl.id]?.updateTexture(baseTexture);
|
|
11030
11032
|
else gl.bindTexture(gl.TEXTURE_2D, baseTexture._glTextures[gl.id] ?? null);
|
|
11031
11033
|
gl.uniform1i(uniform.uniformLocation ?? null, this.textureCount);
|
|
11032
11034
|
this.textureCount += 1;
|
|
@@ -11256,7 +11258,7 @@ var WebGLShaderManager = class {
|
|
|
11256
11258
|
const { gl } = this;
|
|
11257
11259
|
for (i = 0; i < this.attribState.length; i += 1) if (this.attribState[i] !== this.tempAttribState[i]) {
|
|
11258
11260
|
this.attribState[i] = this.tempAttribState[i];
|
|
11259
|
-
if (this.tempAttribState[i]) gl.enableVertexAttribArray(i);
|
|
11261
|
+
if (this.tempAttribState[i] === true) gl.enableVertexAttribArray(i);
|
|
11260
11262
|
else gl.disableVertexAttribArray(i);
|
|
11261
11263
|
}
|
|
11262
11264
|
}
|
|
@@ -11310,7 +11312,7 @@ var AbstractFilter = class {
|
|
|
11310
11312
|
this.dirty = true;
|
|
11311
11313
|
this.padding = 0;
|
|
11312
11314
|
this.uniforms = uniforms ?? {};
|
|
11313
|
-
this.fragmentSrc = fragmentSrc
|
|
11315
|
+
this.fragmentSrc = fragmentSrc;
|
|
11314
11316
|
}
|
|
11315
11317
|
/**
|
|
11316
11318
|
* Initializes the filter.
|
|
@@ -11537,7 +11539,7 @@ var WebGLSpriteBatch = class {
|
|
|
11537
11539
|
nextBlendMode = sprite.blendMode;
|
|
11538
11540
|
nextShader = sprite.shader ?? this.defaultShader;
|
|
11539
11541
|
blendSwap = currentBlendMode !== nextBlendMode;
|
|
11540
|
-
shaderSwap =
|
|
11542
|
+
shaderSwap = currentShader === null || currentShader._UID !== nextShader._UID;
|
|
11541
11543
|
let skip = nextTexture.skipRender;
|
|
11542
11544
|
if (skip && sprite.children.length > 0) skip = false;
|
|
11543
11545
|
if (currentBaseTexture !== nextTexture && !skip || blendSwap || shaderSwap) {
|
|
@@ -11581,7 +11583,7 @@ var WebGLSpriteBatch = class {
|
|
|
11581
11583
|
renderBatch(texture, size, startIndex) {
|
|
11582
11584
|
if (size === 0 || !texture) return;
|
|
11583
11585
|
const { gl } = this;
|
|
11584
|
-
if (texture._dirty[gl.id]) {
|
|
11586
|
+
if (texture._dirty[gl.id] === true) {
|
|
11585
11587
|
if (!this.renderSession.renderer.updateTexture(texture)) return;
|
|
11586
11588
|
} else gl.bindTexture(gl.TEXTURE_2D, texture._glTextures[gl.id] ?? null);
|
|
11587
11589
|
gl.drawElements(gl.TRIANGLES, size * 6, gl.UNSIGNED_SHORT, startIndex * 6 * 2);
|
|
@@ -11818,7 +11820,7 @@ var WebGLRenderer = class {
|
|
|
11818
11820
|
alpha: Boolean(game.config.transparent),
|
|
11819
11821
|
depth: false,
|
|
11820
11822
|
antialias: game.config.antialias,
|
|
11821
|
-
premultipliedAlpha: game.config.transparent && game.config.transparent !== "notMultiplied",
|
|
11823
|
+
premultipliedAlpha: game.config.transparent !== false && game.config.transparent !== "notMultiplied",
|
|
11822
11824
|
stencil: true,
|
|
11823
11825
|
failIfMajorPerformanceCaveat: false,
|
|
11824
11826
|
preserveDrawingBuffer: game.config.preserveDrawingBuffer
|
|
@@ -12031,23 +12033,23 @@ const spriteSheet = (game, key, frameWidth, frameHeight, frameMax, margin, spaci
|
|
|
12031
12033
|
if (img === null) return null;
|
|
12032
12034
|
const { width } = img;
|
|
12033
12035
|
const { height } = img;
|
|
12034
|
-
|
|
12035
|
-
|
|
12036
|
-
let total = Math.floor((width - margin) / (
|
|
12036
|
+
const cellWidth = frameWidth <= 0 ? Math.floor(-width / Math.min(-1, frameWidth)) : frameWidth;
|
|
12037
|
+
const cellHeight = frameHeight <= 0 ? Math.floor(-height / Math.min(-1, frameHeight)) : frameHeight;
|
|
12038
|
+
let total = Math.floor((width - margin) / (cellWidth + spacing)) * Math.floor((height - margin) / (cellHeight + spacing));
|
|
12037
12039
|
if (frameMax !== -1) total = frameMax;
|
|
12038
|
-
if (width === 0 || height === 0 || width <
|
|
12039
|
-
game.logger.warn(`AnimationParser.spriteSheet: '${typeof key === "string" ? key : "image"}'s width/height zero or width/height < given
|
|
12040
|
+
if (width === 0 || height === 0 || width < cellWidth || height < cellHeight || total === 0) {
|
|
12041
|
+
game.logger.warn(`AnimationParser.spriteSheet: '${typeof key === "string" ? key : "image"}'s width/height zero or width/height < given cellWidth/cellHeight`);
|
|
12040
12042
|
return null;
|
|
12041
12043
|
}
|
|
12042
12044
|
const data = new FrameData();
|
|
12043
12045
|
let x = margin;
|
|
12044
12046
|
let y = margin;
|
|
12045
12047
|
for (let i = 0; i < total; i += 1) {
|
|
12046
|
-
data.addFrame(new Frame(i, x, y,
|
|
12047
|
-
x +=
|
|
12048
|
-
if (x +
|
|
12048
|
+
data.addFrame(new Frame(i, x, y, cellWidth, cellHeight, ""));
|
|
12049
|
+
x += cellWidth + spacing;
|
|
12050
|
+
if (x + cellWidth > width) {
|
|
12049
12051
|
x = margin;
|
|
12050
|
-
y +=
|
|
12052
|
+
y += cellHeight + spacing;
|
|
12051
12053
|
}
|
|
12052
12054
|
}
|
|
12053
12055
|
return data;
|
|
@@ -12069,7 +12071,7 @@ const jsonDataHash = (game, json, _key) => {
|
|
|
12069
12071
|
let i = 0;
|
|
12070
12072
|
for (const [key, entry] of Object.entries(frames)) {
|
|
12071
12073
|
const newFrame = data.addFrame(new Frame(i, entry.frame.x, entry.frame.y, entry.frame.w, entry.frame.h, key));
|
|
12072
|
-
if (entry.trimmed && entry.sourceSize && entry.spriteSourceSize) newFrame.setTrim(entry.trimmed, entry.sourceSize.w, entry.sourceSize.h, entry.spriteSourceSize.x, entry.spriteSourceSize.y, entry.spriteSourceSize.w, entry.spriteSourceSize.h);
|
|
12074
|
+
if (entry.trimmed === true && entry.sourceSize !== void 0 && entry.spriteSourceSize !== void 0) newFrame.setTrim(entry.trimmed, entry.sourceSize.w, entry.sourceSize.h, entry.spriteSourceSize.x, entry.spriteSourceSize.y, entry.spriteSourceSize.w, entry.spriteSourceSize.h);
|
|
12073
12075
|
i += 1;
|
|
12074
12076
|
}
|
|
12075
12077
|
return data;
|
|
@@ -12420,7 +12422,7 @@ var Cache = class {
|
|
|
12420
12422
|
*/
|
|
12421
12423
|
checkURL(url) {
|
|
12422
12424
|
const resolved = this._resolveURL(url);
|
|
12423
|
-
if (resolved && this._urlMap?.[resolved]) return true;
|
|
12425
|
+
if (resolved !== null && this._urlMap?.[resolved] !== void 0) return true;
|
|
12424
12426
|
return false;
|
|
12425
12427
|
}
|
|
12426
12428
|
/**
|
|
@@ -12506,7 +12508,7 @@ var Cache = class {
|
|
|
12506
12508
|
getItem(key, cache, _method, property = null) {
|
|
12507
12509
|
if (this.checkKey(cache, key)) {
|
|
12508
12510
|
const entry = this._cacheMap[cache][key];
|
|
12509
|
-
if (
|
|
12511
|
+
if (property === null) return entry;
|
|
12510
12512
|
return entry[property];
|
|
12511
12513
|
}
|
|
12512
12514
|
return null;
|
|
@@ -12687,7 +12689,7 @@ var Cache = class {
|
|
|
12687
12689
|
*/
|
|
12688
12690
|
getURL(url) {
|
|
12689
12691
|
const resolvedURL = this._resolveURL(url);
|
|
12690
|
-
if (resolvedURL) return this._urlMap?.[resolvedURL] ?? null;
|
|
12692
|
+
if (resolvedURL !== null) return this._urlMap?.[resolvedURL] ?? null;
|
|
12691
12693
|
this.game.logger.warn("Cache invalid url", { resolvedURL });
|
|
12692
12694
|
return null;
|
|
12693
12695
|
}
|
|
@@ -12811,7 +12813,7 @@ var Cache = class {
|
|
|
12811
12813
|
*/
|
|
12812
12814
|
destroy() {
|
|
12813
12815
|
for (const cache of this._cacheMap) {
|
|
12814
|
-
const keys =
|
|
12816
|
+
const keys = Object.keys(cache);
|
|
12815
12817
|
for (const key of keys) if (key !== "__default" && key !== "__missing") {
|
|
12816
12818
|
cache[key].destroy?.();
|
|
12817
12819
|
delete cache[key];
|
|
@@ -12917,18 +12919,18 @@ const checkFullScreenSupport = (device) => {
|
|
|
12917
12919
|
"mozExitFullscreen"
|
|
12918
12920
|
];
|
|
12919
12921
|
const elementApi = document.createElement("div");
|
|
12920
|
-
for (const name of fs) if (elementApi[name]) {
|
|
12922
|
+
for (const name of fs) if (elementApi[name] !== void 0) {
|
|
12921
12923
|
device.fullscreen = true;
|
|
12922
12924
|
device.requestFullscreen = name;
|
|
12923
12925
|
break;
|
|
12924
12926
|
}
|
|
12925
12927
|
if (device.fullscreen) {
|
|
12926
12928
|
const documentApi = document;
|
|
12927
|
-
for (const name of cfs) if (documentApi[name]) {
|
|
12929
|
+
for (const name of cfs) if (documentApi[name] !== void 0) {
|
|
12928
12930
|
device.cancelFullscreen = name;
|
|
12929
12931
|
break;
|
|
12930
12932
|
}
|
|
12931
|
-
if (
|
|
12933
|
+
if (Element.ALLOW_KEYBOARD_INPUT !== void 0) device.fullscreenKeyboard = true;
|
|
12932
12934
|
}
|
|
12933
12935
|
};
|
|
12934
12936
|
/**
|
|
@@ -13025,7 +13027,7 @@ const checkAudio = (device) => {
|
|
|
13025
13027
|
}
|
|
13026
13028
|
]) {
|
|
13027
13029
|
const { type, codecs } = format;
|
|
13028
|
-
for (const codec of codecs) if (
|
|
13030
|
+
for (const codec of codecs) if (device.supportedAudioFormats[type] !== true) {
|
|
13029
13031
|
const isSupported = isMediaSourceTypeSupported(codec) || canPlayType(audioElement, codec);
|
|
13030
13032
|
if (isSupported) device.supportedAudioFormats[type] = isSupported;
|
|
13031
13033
|
}
|
|
@@ -13119,7 +13121,7 @@ var ArraySet = class {
|
|
|
13119
13121
|
* @param {object} value - TBD.
|
|
13120
13122
|
*/
|
|
13121
13123
|
setAll(key, value) {
|
|
13122
|
-
for (const item of this.list) if (item) item[key] = value;
|
|
13124
|
+
for (const item of this.list) if (item !== void 0) item[key] = value;
|
|
13123
13125
|
}
|
|
13124
13126
|
/**
|
|
13125
13127
|
* TBD.
|
|
@@ -13139,7 +13141,7 @@ var ArraySet = class {
|
|
|
13139
13141
|
removeAll(destroy = false) {
|
|
13140
13142
|
for (let i = this.list.length - 1; i >= 0; i -= 1) {
|
|
13141
13143
|
const entry = this.list[i];
|
|
13142
|
-
if (entry) {
|
|
13144
|
+
if (entry !== void 0) {
|
|
13143
13145
|
const item = this.remove(entry);
|
|
13144
13146
|
if (destroy) item?.destroy?.();
|
|
13145
13147
|
}
|
|
@@ -13271,7 +13273,7 @@ var Mouse = class {
|
|
|
13271
13273
|
canvas.addEventListener("mouseover", this._onMouseOver, true);
|
|
13272
13274
|
canvas.addEventListener("mouseout", this._onMouseOut, true);
|
|
13273
13275
|
const { wheelEvent } = this.game.device;
|
|
13274
|
-
if (wheelEvent) canvas.addEventListener(wheelEvent, this._onMouseWheel, true);
|
|
13276
|
+
if (wheelEvent !== null) canvas.addEventListener(wheelEvent, this._onMouseWheel, true);
|
|
13275
13277
|
}
|
|
13276
13278
|
/**
|
|
13277
13279
|
* TBD.
|
|
@@ -13284,9 +13286,9 @@ var Mouse = class {
|
|
|
13284
13286
|
if (this._onMouseOver) canvas.removeEventListener("mouseover", this._onMouseOver, true);
|
|
13285
13287
|
if (this._onMouseOut) canvas.removeEventListener("mouseout", this._onMouseOut, true);
|
|
13286
13288
|
const { wheelEvent } = this.game.device;
|
|
13287
|
-
if (wheelEvent && this._onMouseWheel) canvas.removeEventListener(wheelEvent, this._onMouseWheel, true);
|
|
13288
|
-
if (this._onMouseUpGlobal) globalThis.removeEventListener("mouseup", this._onMouseUpGlobal, true);
|
|
13289
|
-
if (this._onMouseOutGlobal) globalThis.removeEventListener("mouseout", this._onMouseOutGlobal, true);
|
|
13289
|
+
if (wheelEvent !== null && this._onMouseWheel) canvas.removeEventListener(wheelEvent, this._onMouseWheel, true);
|
|
13290
|
+
if (this._onMouseUpGlobal !== null) globalThis.removeEventListener("mouseup", this._onMouseUpGlobal, true);
|
|
13291
|
+
if (this._onMouseOutGlobal !== null) globalThis.removeEventListener("mouseout", this._onMouseOutGlobal, true);
|
|
13290
13292
|
}
|
|
13291
13293
|
/**
|
|
13292
13294
|
* TBD.
|
|
@@ -13708,7 +13710,7 @@ var Pointer = class {
|
|
|
13708
13710
|
*/
|
|
13709
13711
|
start(event) {
|
|
13710
13712
|
const { input } = this.game;
|
|
13711
|
-
if (event.pointerId) this.pointerId = event.pointerId;
|
|
13713
|
+
if (event.pointerId !== void 0) this.pointerId = event.pointerId;
|
|
13712
13714
|
this.identifier = event.identifier ?? null;
|
|
13713
13715
|
this.target = event.target;
|
|
13714
13716
|
if (this.isMouse) this.updateButtons(event);
|
|
@@ -14533,7 +14535,7 @@ var Input = class {
|
|
|
14533
14535
|
if (!displayObject.worldVisible) return false;
|
|
14534
14536
|
this.getLocalPosition(displayObject, pointer, this._localPoint);
|
|
14535
14537
|
localPoint.copyFrom(this._localPoint);
|
|
14536
|
-
if (displayObject.hitArea
|
|
14538
|
+
if (displayObject.hitArea !== null) return displayObject.hitArea.contains(this._localPoint.x, this._localPoint.y);
|
|
14537
14539
|
else if (displayObject instanceof Image$1) {
|
|
14538
14540
|
const { width } = displayObject.texture.frame;
|
|
14539
14541
|
const { height } = displayObject.texture.frame;
|
|
@@ -14543,7 +14545,7 @@ var Input = class {
|
|
|
14543
14545
|
if (this._localPoint.y >= y1 && this._localPoint.y < y1 + height) return true;
|
|
14544
14546
|
}
|
|
14545
14547
|
} else if (displayObject instanceof Graphics) {
|
|
14546
|
-
for (const data of displayObject.graphicsData) if (data.fill && data.shape
|
|
14548
|
+
for (const data of displayObject.graphicsData) if (data.fill && (data.shape?.contains(this._localPoint.x, this._localPoint.y) ?? false)) return true;
|
|
14547
14549
|
}
|
|
14548
14550
|
for (const child of displayObject.children) if (this.hitTest(child, pointer, localPoint)) return true;
|
|
14549
14551
|
return false;
|
|
@@ -14788,18 +14790,19 @@ var Loader = class {
|
|
|
14788
14790
|
this.game.logger.warn(`Loader: Invalid or no key given of type ${type}`);
|
|
14789
14791
|
return this;
|
|
14790
14792
|
}
|
|
14791
|
-
|
|
14792
|
-
|
|
14793
|
-
|
|
14793
|
+
let resolvedUrl = url;
|
|
14794
|
+
if (resolvedUrl === void 0 || resolvedUrl === null) {
|
|
14795
|
+
if (extension === null) {
|
|
14794
14796
|
this.game.logger.warn(`Loader: No URL given for file type: ${type} key: ${key}`);
|
|
14795
14797
|
return this;
|
|
14796
14798
|
}
|
|
14799
|
+
resolvedUrl = key + extension;
|
|
14797
14800
|
}
|
|
14798
14801
|
const file = {
|
|
14799
14802
|
type,
|
|
14800
14803
|
key,
|
|
14801
14804
|
path: this.path,
|
|
14802
|
-
url,
|
|
14805
|
+
url: resolvedUrl,
|
|
14803
14806
|
syncPoint: this._withSyncPointDepth > 0,
|
|
14804
14807
|
data: null,
|
|
14805
14808
|
loading: false,
|
|
@@ -14853,9 +14856,8 @@ var Loader = class {
|
|
|
14853
14856
|
error: false,
|
|
14854
14857
|
callbackContext
|
|
14855
14858
|
};
|
|
14856
|
-
if (data) {
|
|
14857
|
-
|
|
14858
|
-
pack.data = data ?? {};
|
|
14859
|
+
if (data !== null) {
|
|
14860
|
+
pack.data = (typeof data === "string" ? JSON.parse(data) : data) ?? {};
|
|
14859
14861
|
pack.loaded = true;
|
|
14860
14862
|
}
|
|
14861
14863
|
for (let i = 0; i < this._fileList.length + 1; i += 1) {
|
|
@@ -14948,8 +14950,8 @@ var Loader = class {
|
|
|
14948
14950
|
*/
|
|
14949
14951
|
audio(key, urls, autoDecode = true) {
|
|
14950
14952
|
if (this.game.sound.noAudio || this.game.device.noAudioFormat) return this;
|
|
14951
|
-
|
|
14952
|
-
return this.addToFileList("audio", key,
|
|
14953
|
+
const sources = typeof urls === "string" ? [urls] : urls;
|
|
14954
|
+
return this.addToFileList("audio", key, sources, {
|
|
14953
14955
|
buffer: null,
|
|
14954
14956
|
autoDecode
|
|
14955
14957
|
});
|
|
@@ -14967,9 +14969,9 @@ var Loader = class {
|
|
|
14967
14969
|
if (this.game.sound.noAudio || this.game.device.noAudioFormat) return this;
|
|
14968
14970
|
this.audio(key, urls, autoDecode);
|
|
14969
14971
|
if (jsonURL) this.json(`${key}-audioatlas`, jsonURL);
|
|
14970
|
-
else if (jsonData) {
|
|
14971
|
-
|
|
14972
|
-
this.cache.addJSON(`${key}-audioatlas`, "",
|
|
14972
|
+
else if (jsonData !== null) {
|
|
14973
|
+
const parsed = typeof jsonData === "string" ? JSON.parse(jsonData) : jsonData;
|
|
14974
|
+
this.cache.addJSON(`${key}-audioatlas`, "", parsed);
|
|
14973
14975
|
}
|
|
14974
14976
|
return this;
|
|
14975
14977
|
}
|
|
@@ -14985,10 +14987,10 @@ var Loader = class {
|
|
|
14985
14987
|
* @throws {Error} If the bitmap font atlas data is invalid.
|
|
14986
14988
|
*/
|
|
14987
14989
|
bitmapFont(key, textureURL = null, atlasURL = null, atlasData = null, xSpacing = 0, ySpacing = 0) {
|
|
14988
|
-
textureURL
|
|
14989
|
-
|
|
14990
|
-
if (
|
|
14991
|
-
atlasURL,
|
|
14990
|
+
const texture = textureURL ?? `${key}.png`;
|
|
14991
|
+
const atlas = atlasURL === null && atlasData === null ? `${key}.xml` : atlasURL;
|
|
14992
|
+
if (atlas !== null) this.addToFileList("bitmapfont", key, texture, {
|
|
14993
|
+
atlasURL: atlas,
|
|
14992
14994
|
xSpacing,
|
|
14993
14995
|
ySpacing
|
|
14994
14996
|
});
|
|
@@ -15000,11 +15002,11 @@ var Loader = class {
|
|
|
15000
15002
|
} catch {
|
|
15001
15003
|
xml = this.parseXml(atlasData);
|
|
15002
15004
|
}
|
|
15003
|
-
if (
|
|
15004
|
-
this.addToFileList("bitmapfont", key,
|
|
15005
|
+
if (xml === null && json === null) throw new Error(ENGINE_ERROR_INVALID_BITMAP_FONT_ATLAS);
|
|
15006
|
+
this.addToFileList("bitmapfont", key, texture, {
|
|
15005
15007
|
atlasURL: null,
|
|
15006
15008
|
atlasData: json ?? xml,
|
|
15007
|
-
atlasType: json ? "
|
|
15009
|
+
atlasType: json === null ? "xml" : "json",
|
|
15008
15010
|
xSpacing,
|
|
15009
15011
|
ySpacing
|
|
15010
15012
|
});
|
|
@@ -15021,13 +15023,13 @@ var Loader = class {
|
|
|
15021
15023
|
* @returns {Loader} This Loader instance for chaining.
|
|
15022
15024
|
*/
|
|
15023
15025
|
atlas(key, textureURL, atlasURL = null, atlasData = null, format = TEXTURE_ATLAS_JSON_HASH) {
|
|
15024
|
-
textureURL
|
|
15025
|
-
|
|
15026
|
-
if (
|
|
15027
|
-
atlasURL,
|
|
15026
|
+
const texture = textureURL ?? `${key}.png`;
|
|
15027
|
+
const atlas = atlasURL === null && atlasData === null ? `${key}.json` : atlasURL;
|
|
15028
|
+
if (atlas !== null) this.addToFileList("textureatlas", key, texture, {
|
|
15029
|
+
atlasURL: atlas,
|
|
15028
15030
|
format
|
|
15029
15031
|
});
|
|
15030
|
-
else this.addToFileList("textureatlas", key,
|
|
15032
|
+
else this.addToFileList("textureatlas", key, texture, {
|
|
15031
15033
|
atlasURL: null,
|
|
15032
15034
|
atlasData,
|
|
15033
15035
|
format
|
|
@@ -15125,7 +15127,7 @@ var Loader = class {
|
|
|
15125
15127
|
if (file.loaded || file.error) {
|
|
15126
15128
|
if (i === this._processingHead) this._processingHead = i + 1;
|
|
15127
15129
|
} else if (!file.loading && this._flightQueue.length < inflightLimit) {
|
|
15128
|
-
if (file.type === "packfile" &&
|
|
15130
|
+
if (file.type === "packfile" && file.data === null) {
|
|
15129
15131
|
this._flightQueue.push(file);
|
|
15130
15132
|
file.loading = true;
|
|
15131
15133
|
this.loadFile(file);
|
|
@@ -15254,7 +15256,7 @@ var Loader = class {
|
|
|
15254
15256
|
break;
|
|
15255
15257
|
case "audio": {
|
|
15256
15258
|
const resolved = this.getAudioURL(file.url);
|
|
15257
|
-
if (resolved) {
|
|
15259
|
+
if (resolved !== null) {
|
|
15258
15260
|
file.url = resolved;
|
|
15259
15261
|
this.xhrLoad(file, this.transformUrl(resolved, file), "arraybuffer", this.fileComplete);
|
|
15260
15262
|
} else if (this.game.sound.noAudio) this.fileError(file, null, "Device does not have audio playback support");
|
|
@@ -15289,8 +15291,8 @@ var Loader = class {
|
|
|
15289
15291
|
}
|
|
15290
15292
|
}, { once: true });
|
|
15291
15293
|
image.addEventListener("error", () => {
|
|
15292
|
-
if (this.isUseRetry && (
|
|
15293
|
-
file.numRetry = file.numRetry ? file.numRetry + 1
|
|
15294
|
+
if (this.isUseRetry && (file.numRetry === void 0 || file.numRetry < this.maxRetry)) setTimeout(() => {
|
|
15295
|
+
file.numRetry = file.numRetry === void 0 ? 1 : file.numRetry + 1;
|
|
15294
15296
|
this.loadImageTag(file);
|
|
15295
15297
|
}, 1e3);
|
|
15296
15298
|
else if (!settled) {
|
|
@@ -15325,12 +15327,12 @@ var Loader = class {
|
|
|
15325
15327
|
const { requestedWith } = this.headers;
|
|
15326
15328
|
if (requestedWith !== false && requestedWith !== void 0) xhr.setRequestHeader("X-Requested-With", requestedWith);
|
|
15327
15329
|
const acceptHeader = this.headers[file.type];
|
|
15328
|
-
if (acceptHeader) xhr.setRequestHeader("Accept", acceptHeader);
|
|
15330
|
+
if (acceptHeader !== void 0 && acceptHeader !== false) xhr.setRequestHeader("Accept", acceptHeader);
|
|
15329
15331
|
const handleError = onerror ?? this.fileError;
|
|
15330
15332
|
const retry = () => {
|
|
15331
|
-
if (!this.isUseRetry || file.numRetry && file.numRetry >= this.maxRetry) return false;
|
|
15333
|
+
if (!this.isUseRetry || file.numRetry !== void 0 && file.numRetry >= this.maxRetry) return false;
|
|
15332
15334
|
setTimeout(() => {
|
|
15333
|
-
file.numRetry = file.numRetry ? file.numRetry + 1
|
|
15335
|
+
file.numRetry = file.numRetry === void 0 ? 1 : file.numRetry + 1;
|
|
15334
15336
|
this.xhrLoad(file, url, type, onload, handleError);
|
|
15335
15337
|
}, 1e3);
|
|
15336
15338
|
return true;
|
|
@@ -15406,8 +15408,8 @@ var Loader = class {
|
|
|
15406
15408
|
* @param {number | string} reason - The error code or message explaining the failure.
|
|
15407
15409
|
*/
|
|
15408
15410
|
fileError(file, xhr = null, reason = 0) {
|
|
15409
|
-
|
|
15410
|
-
const message = `Error loading asset (${String(
|
|
15411
|
+
const cause = reason === 0 && xhr !== null ? xhr.status : reason;
|
|
15412
|
+
const message = `Error loading asset (${String(cause)})`;
|
|
15411
15413
|
this.asyncComplete(file, message);
|
|
15412
15414
|
}
|
|
15413
15415
|
/**
|
|
@@ -15439,7 +15441,7 @@ var Loader = class {
|
|
|
15439
15441
|
}
|
|
15440
15442
|
break;
|
|
15441
15443
|
case "bitmapfont":
|
|
15442
|
-
if (
|
|
15444
|
+
if (file.atlasURL === null || file.atlasURL === void 0) this.cache.addBitmapFont(file.key, url, file.data, file.atlasData, file.atlasType ?? "xml", file.xSpacing ?? 0, file.ySpacing ?? 0);
|
|
15443
15445
|
else {
|
|
15444
15446
|
loadNext = false;
|
|
15445
15447
|
this.xhrLoad(file, this.transformUrl(file.atlasURL, file), "text", (bitmapFontFile, bitmapFontXhr) => {
|
|
@@ -15447,7 +15449,7 @@ var Loader = class {
|
|
|
15447
15449
|
try {
|
|
15448
15450
|
json = JSON.parse(bitmapFontXhr.responseText);
|
|
15449
15451
|
} catch {}
|
|
15450
|
-
if (json) {
|
|
15452
|
+
if (json !== void 0) {
|
|
15451
15453
|
bitmapFontFile.atlasType = "json";
|
|
15452
15454
|
this.jsonLoadComplete(bitmapFontFile, bitmapFontXhr);
|
|
15453
15455
|
} else {
|
|
@@ -15461,7 +15463,7 @@ var Loader = class {
|
|
|
15461
15463
|
const audio = response.response;
|
|
15462
15464
|
file.data = audio;
|
|
15463
15465
|
this.cache.addSound(file.key, url, audio);
|
|
15464
|
-
if (file.autoDecode) this.game.sound.decode(file.key);
|
|
15466
|
+
if (file.autoDecode === true) this.game.sound.decode(file.key);
|
|
15465
15467
|
break;
|
|
15466
15468
|
}
|
|
15467
15469
|
case "text": {
|
|
@@ -15534,7 +15536,7 @@ var Loader = class {
|
|
|
15534
15536
|
if (this.preloadSprite) {
|
|
15535
15537
|
if (this.preloadSprite.direction === 0) this.preloadSprite.rect.width = Math.floor(this.preloadSprite.width / 100 * this.progress);
|
|
15536
15538
|
else this.preloadSprite.rect.height = Math.floor(this.preloadSprite.height / 100 * this.progress);
|
|
15537
|
-
if (this.preloadSprite.sprite) this.preloadSprite.sprite.updateCrop();
|
|
15539
|
+
if (this.preloadSprite.sprite !== null) this.preloadSprite.sprite.updateCrop();
|
|
15538
15540
|
else this.preloadSprite = null;
|
|
15539
15541
|
}
|
|
15540
15542
|
}
|
|
@@ -15636,14 +15638,14 @@ var VisualBoundsDesktopRectangle = class {
|
|
|
15636
15638
|
* @returns {number} The horizontal scroll position in pixels.
|
|
15637
15639
|
*/
|
|
15638
15640
|
get x() {
|
|
15639
|
-
return
|
|
15641
|
+
return "pageXOffset" in globalThis ? window.pageXOffset : document.documentElement.scrollLeft;
|
|
15640
15642
|
}
|
|
15641
15643
|
/**
|
|
15642
15644
|
* Gets the vertical scroll position of the window.
|
|
15643
15645
|
* @returns {number} The vertical scroll position in pixels.
|
|
15644
15646
|
*/
|
|
15645
15647
|
get y() {
|
|
15646
|
-
return
|
|
15648
|
+
return "pageYOffset" in globalThis ? window.pageYOffset : document.documentElement.scrollTop;
|
|
15647
15649
|
}
|
|
15648
15650
|
/**
|
|
15649
15651
|
* Gets the width of the window.
|
|
@@ -15692,14 +15694,14 @@ var VisualBoundsRectangle = class {
|
|
|
15692
15694
|
* @returns {number} The horizontal scroll position in pixels.
|
|
15693
15695
|
*/
|
|
15694
15696
|
get x() {
|
|
15695
|
-
return
|
|
15697
|
+
return "pageXOffset" in globalThis ? window.pageXOffset : document.documentElement.scrollLeft;
|
|
15696
15698
|
}
|
|
15697
15699
|
/**
|
|
15698
15700
|
* Gets the vertical scroll position of the document.
|
|
15699
15701
|
* @returns {number} The vertical scroll position in pixels.
|
|
15700
15702
|
*/
|
|
15701
15703
|
get y() {
|
|
15702
|
-
return
|
|
15704
|
+
return "pageYOffset" in globalThis ? window.pageYOffset : document.documentElement.scrollTop;
|
|
15703
15705
|
}
|
|
15704
15706
|
/**
|
|
15705
15707
|
* TBD.
|
|
@@ -15790,8 +15792,8 @@ var DOM = class {
|
|
|
15790
15792
|
this.visualBounds = this.treatAsDesktop ? new VisualBoundsDesktopRectangle() : new VisualBoundsRectangle();
|
|
15791
15793
|
this.layoutBounds = this.treatAsDesktop ? new LayoutBoundsDesktopRectangle() : new LayoutBoundsRectangle();
|
|
15792
15794
|
this.documentBounds = new DocumentBoundsRectangle();
|
|
15793
|
-
this.scrollXProvider =
|
|
15794
|
-
this.scrollYProvider =
|
|
15795
|
+
this.scrollXProvider = "pageXOffset" in globalThis ? () => window.pageXOffset : () => document.documentElement.scrollLeft;
|
|
15796
|
+
this.scrollYProvider = "pageYOffset" in globalThis ? () => window.pageYOffset : () => document.documentElement.scrollTop;
|
|
15795
15797
|
}
|
|
15796
15798
|
/**
|
|
15797
15799
|
* Gets the offset position of an element relative to the document.
|
|
@@ -15817,9 +15819,9 @@ var DOM = class {
|
|
|
15817
15819
|
* @returns {boolean} True if bounds were successfully retrieved, false otherwise.
|
|
15818
15820
|
*/
|
|
15819
15821
|
getBounds(element, cushion = 0) {
|
|
15820
|
-
|
|
15821
|
-
if (
|
|
15822
|
-
return this.calibrate(
|
|
15822
|
+
const target = element.nodeType === void 0 ? element[0] : element;
|
|
15823
|
+
if (target?.nodeType !== 1) return false;
|
|
15824
|
+
return this.calibrate(target.getBoundingClientRect(), cushion);
|
|
15823
15825
|
}
|
|
15824
15826
|
/**
|
|
15825
15827
|
* Calibrates DOM rectangle coordinates with optional cushion.
|
|
@@ -15846,17 +15848,17 @@ var DOM = class {
|
|
|
15846
15848
|
* @returns {string} The screen orientation ('portrait-primary', 'landscape-primary', etc.).
|
|
15847
15849
|
*/
|
|
15848
15850
|
getScreenOrientation(primaryFallback = null) {
|
|
15849
|
-
const
|
|
15850
|
-
const orientation = screen.orientation
|
|
15851
|
-
if (
|
|
15852
|
-
|
|
15851
|
+
const screen = globalThis.screen;
|
|
15852
|
+
const orientation = screen.orientation ?? screen.mozOrientation ?? screen.msOrientation;
|
|
15853
|
+
if (typeof orientation === "string") return orientation;
|
|
15854
|
+
if (typeof orientation?.type === "string") return orientation.type;
|
|
15853
15855
|
const PORTRAIT = "portrait-primary";
|
|
15854
15856
|
const LANDSCAPE = "landscape-primary";
|
|
15855
15857
|
if (primaryFallback === "screen") return screen.height > screen.width ? PORTRAIT : LANDSCAPE;
|
|
15856
15858
|
else if (primaryFallback === "viewport") return this.visualBounds.height > this.visualBounds.width ? PORTRAIT : LANDSCAPE;
|
|
15857
15859
|
const { orientation: legacyOrientation } = globalThis;
|
|
15858
15860
|
if (primaryFallback === "window.orientation" && typeof legacyOrientation === "number") return legacyOrientation === 0 || legacyOrientation === 180 ? PORTRAIT : LANDSCAPE;
|
|
15859
|
-
else if (globalThis.matchMedia) {
|
|
15861
|
+
else if (typeof globalThis.matchMedia === "function") {
|
|
15860
15862
|
if (globalThis.matchMedia("(orientation: portrait)").matches) return PORTRAIT;
|
|
15861
15863
|
else if (globalThis.matchMedia("(orientation: landscape)").matches) return LANDSCAPE;
|
|
15862
15864
|
}
|
|
@@ -16104,7 +16106,7 @@ var ScaleManager = class {
|
|
|
16104
16106
|
const rect = new Rectangle();
|
|
16105
16107
|
if (this.game.parent !== "") {
|
|
16106
16108
|
if (typeof this.game.parent === "string") target = document.querySelector(`#${CSS.escape(this.game.parent)}`);
|
|
16107
|
-
else if (this.game.parent && this.game.parent.nodeType === 1) target = this.game.parent;
|
|
16109
|
+
else if (typeof this.game.parent === "object" && this.game.parent.nodeType === 1) target = this.game.parent;
|
|
16108
16110
|
}
|
|
16109
16111
|
if (!target) {
|
|
16110
16112
|
this.parentNode = null;
|
|
@@ -16259,7 +16261,7 @@ var ScaleManager = class {
|
|
|
16259
16261
|
this.aspectRatio = this.width / this.height;
|
|
16260
16262
|
if (this.game.canvas) this.dom.getOffset(this.game.canvas, this.offset);
|
|
16261
16263
|
this.bounds.setTo(this.offset.x, this.offset.y, this.width, this.height);
|
|
16262
|
-
if (this.game.input
|
|
16264
|
+
if (this.game.input) this.game.input.scale.setTo(this.scaleFactor.x, this.scaleFactor.y);
|
|
16263
16265
|
}
|
|
16264
16266
|
/**
|
|
16265
16267
|
* TBD.
|
|
@@ -16360,7 +16362,7 @@ var ScaleManager = class {
|
|
|
16360
16362
|
* @returns {Rectangle} TBD.
|
|
16361
16363
|
*/
|
|
16362
16364
|
getParentBounds(target) {
|
|
16363
|
-
const bounds = target
|
|
16365
|
+
const bounds = target ?? new Rectangle();
|
|
16364
16366
|
const parentNode = this.boundingParent;
|
|
16365
16367
|
const { visualBounds } = this.dom;
|
|
16366
16368
|
const { layoutBounds } = this.dom;
|
|
@@ -16509,8 +16511,8 @@ var ScaleManager = class {
|
|
|
16509
16511
|
this.width = bounds.width;
|
|
16510
16512
|
this.height = bounds.height;
|
|
16511
16513
|
if (this.isFullScreen) return;
|
|
16512
|
-
if (this.maxWidth) this.width = Math.min(this.width, this.maxWidth);
|
|
16513
|
-
if (this.maxHeight) this.height = Math.min(this.height, this.maxHeight);
|
|
16514
|
+
if (this.maxWidth !== null) this.width = Math.min(this.width, this.maxWidth);
|
|
16515
|
+
if (this.maxHeight !== null) this.height = Math.min(this.height, this.maxHeight);
|
|
16514
16516
|
}
|
|
16515
16517
|
/**
|
|
16516
16518
|
* TBD.
|
|
@@ -16539,7 +16541,7 @@ var ScaleManager = class {
|
|
|
16539
16541
|
}
|
|
16540
16542
|
if (this.compatibility.clickTrampoline === "when-not-mouse") {
|
|
16541
16543
|
const { input } = this.game;
|
|
16542
|
-
if (input.activePointer && input.activePointer !== input.mousePointer && allowTrampoline) {
|
|
16544
|
+
if (input.activePointer !== null && input.activePointer !== input.mousePointer && allowTrampoline) {
|
|
16543
16545
|
input.activePointer.addClickTrampoline("startFullScreen", this.startFullScreen, this, [antialias, false]);
|
|
16544
16546
|
return false;
|
|
16545
16547
|
}
|
|
@@ -16661,7 +16663,7 @@ var ScaleManager = class {
|
|
|
16661
16663
|
*/
|
|
16662
16664
|
get boundingParent() {
|
|
16663
16665
|
if (this.parentIsWindow || this.isFullScreen && this.hasPhaserSetFullScreen && !this._createdFullScreenTarget) return null;
|
|
16664
|
-
return
|
|
16666
|
+
return this.game.canvas.parentNode ?? null ?? null;
|
|
16665
16667
|
}
|
|
16666
16668
|
/**
|
|
16667
16669
|
* TBD.
|
|
@@ -16902,7 +16904,7 @@ var SceneManager = class {
|
|
|
16902
16904
|
this._pendingState = key;
|
|
16903
16905
|
this._clearWorld = clearWorld;
|
|
16904
16906
|
this._clearCache = clearCache;
|
|
16905
|
-
if (args
|
|
16907
|
+
if (args.length > 0) this._args = [...args];
|
|
16906
16908
|
}
|
|
16907
16909
|
}
|
|
16908
16910
|
/**
|
|
@@ -16915,7 +16917,7 @@ var SceneManager = class {
|
|
|
16915
16917
|
this._pendingState = this.current;
|
|
16916
16918
|
this._clearWorld = clearWorld;
|
|
16917
16919
|
this._clearCache = clearCache;
|
|
16918
|
-
if (args
|
|
16920
|
+
if (args.length > 0) this._args = [...args];
|
|
16919
16921
|
}
|
|
16920
16922
|
/**
|
|
16921
16923
|
* Pre-update the scene manager.
|
|
@@ -17133,7 +17135,7 @@ var Sound = class {
|
|
|
17133
17135
|
* @param {boolean} connect - Whether to connect to the master gain node.
|
|
17134
17136
|
*/
|
|
17135
17137
|
constructor(game, key, volume = 1, loop = false, connect = null) {
|
|
17136
|
-
connect
|
|
17138
|
+
const connectToMaster = connect ?? game.sound.connectToMaster;
|
|
17137
17139
|
this.game = game;
|
|
17138
17140
|
this.name = key;
|
|
17139
17141
|
this.key = key;
|
|
@@ -17165,7 +17167,7 @@ var Sound = class {
|
|
|
17165
17167
|
const gainNode = this.context.createGain === void 0 ? this.context.createGainNode() : this.context.createGain();
|
|
17166
17168
|
this.gainNode = gainNode;
|
|
17167
17169
|
gainNode.gain.value = volume * this.game.sound.volume;
|
|
17168
|
-
if (
|
|
17170
|
+
if (connectToMaster && this.masterGainNode !== null) gainNode.connect(this.masterGainNode);
|
|
17169
17171
|
this.onPlay = new Signal();
|
|
17170
17172
|
this.onPause = new Signal();
|
|
17171
17173
|
this.onResume = new Signal();
|
|
@@ -17296,8 +17298,7 @@ var Sound = class {
|
|
|
17296
17298
|
* @returns {Sound} This Sound instance for chaining.
|
|
17297
17299
|
*/
|
|
17298
17300
|
play(marker = "", position = 0, volume = 1, loop = false, forceRestart = true) {
|
|
17299
|
-
|
|
17300
|
-
forceRestart ??= true;
|
|
17301
|
+
const markerName = marker === void 0 || marker === false || marker === null ? "" : marker;
|
|
17301
17302
|
if (this.isPlaying && !this.allowMultiple && !forceRestart && !this.override) return this;
|
|
17302
17303
|
if (this._sound && this.isPlaying && !this.allowMultiple && (this.override || forceRestart)) {
|
|
17303
17304
|
if (this._sound.stop === void 0) this._sound.noteOff(0);
|
|
@@ -17306,11 +17307,11 @@ var Sound = class {
|
|
|
17306
17307
|
else if (this.gainNode) this._sound.disconnect(this.gainNode);
|
|
17307
17308
|
this.isPlaying = false;
|
|
17308
17309
|
}
|
|
17309
|
-
if (
|
|
17310
|
-
const markerData =
|
|
17311
|
-
if (
|
|
17310
|
+
if (markerName === "" && Object.keys(this.markers).length > 0) return this;
|
|
17311
|
+
const markerData = markerName === "" ? void 0 : this.markers[markerName];
|
|
17312
|
+
if (markerName !== "") {
|
|
17312
17313
|
if (markerData) {
|
|
17313
|
-
this.currentMarker =
|
|
17314
|
+
this.currentMarker = markerName;
|
|
17314
17315
|
this.position = markerData.start;
|
|
17315
17316
|
this.volume = markerData.volume;
|
|
17316
17317
|
this.loop = markerData.loop;
|
|
@@ -17318,43 +17319,40 @@ var Sound = class {
|
|
|
17318
17319
|
this.durationMS = markerData.durationMS;
|
|
17319
17320
|
if (volume !== void 0) this.volume = volume;
|
|
17320
17321
|
if (loop !== void 0) this.loop = loop;
|
|
17321
|
-
this._tempMarker =
|
|
17322
|
+
this._tempMarker = markerName;
|
|
17322
17323
|
this._tempPosition = this.position;
|
|
17323
17324
|
this._tempVolume = this.volume;
|
|
17324
17325
|
this._tempLoop = this.loop;
|
|
17325
17326
|
} else {
|
|
17326
|
-
this.game.logger.warn(`Sound.play: audio marker ${
|
|
17327
|
+
this.game.logger.warn(`Sound.play: audio marker ${markerName} does not exist`);
|
|
17327
17328
|
return this;
|
|
17328
17329
|
}
|
|
17329
17330
|
} else {
|
|
17330
|
-
position
|
|
17331
|
-
volume
|
|
17332
|
-
|
|
17333
|
-
this.position = Math.max(0, position);
|
|
17334
|
-
this.volume = volume;
|
|
17335
|
-
this.loop = loop;
|
|
17331
|
+
this.position = Math.max(0, position ?? 0);
|
|
17332
|
+
this.volume = volume ?? this._volume;
|
|
17333
|
+
this.loop = loop ?? this.loop;
|
|
17336
17334
|
this.duration = 0;
|
|
17337
17335
|
this.durationMS = 0;
|
|
17338
|
-
this._tempMarker =
|
|
17336
|
+
this._tempMarker = markerName;
|
|
17339
17337
|
this._tempPosition = position;
|
|
17340
17338
|
this._tempVolume = volume;
|
|
17341
17339
|
this._tempLoop = loop;
|
|
17342
17340
|
}
|
|
17343
|
-
if (this.game.cache.isSoundDecoded(this.key)) {
|
|
17341
|
+
if (this.game.cache.isSoundDecoded(this.key) === true) {
|
|
17344
17342
|
this._sound = this.context.createBufferSource();
|
|
17345
17343
|
if (this.externalNode) this._sound.connect(this.externalNode);
|
|
17346
17344
|
else this._sound.connect(this.gainNode);
|
|
17347
17345
|
this._buffer = this.game.cache.getSoundData(this.key);
|
|
17348
17346
|
this._sound.buffer = this._buffer;
|
|
17349
|
-
if (this.loop &&
|
|
17350
|
-
if (!this.loop &&
|
|
17347
|
+
if (this.loop && markerName === "") this._sound.loop = true;
|
|
17348
|
+
if (!this.loop && markerName === "") this._sound.addEventListener("ended", this.onEndedHandler, { once: true });
|
|
17351
17349
|
this.totalDuration = this._sound.buffer?.duration ?? 0;
|
|
17352
17350
|
if (this.duration === 0) {
|
|
17353
17351
|
this.duration = this.totalDuration;
|
|
17354
17352
|
this.durationMS = Math.ceil(this.totalDuration * 1e3);
|
|
17355
17353
|
}
|
|
17356
17354
|
if (this._sound.start === void 0) this._sound.noteGrainOn(0, this.position, this.duration);
|
|
17357
|
-
else if (this.loop &&
|
|
17355
|
+
else if (this.loop && markerName === "") this._sound.start(0, 0);
|
|
17358
17356
|
else this._sound.start(0, this.position, this.duration);
|
|
17359
17357
|
this.isPlaying = true;
|
|
17360
17358
|
this.startTime = this.game.time.time;
|
|
@@ -17559,7 +17557,7 @@ var SoundSprite = class {
|
|
|
17559
17557
|
sound.addMarker(markerKey, marker.start, marker.end - marker.start, void 0, marker.loop);
|
|
17560
17558
|
this.sounds[markerKey] = sound;
|
|
17561
17559
|
}
|
|
17562
|
-
if (this.config.autoplay) {
|
|
17560
|
+
if (this.config.autoplay !== void 0) {
|
|
17563
17561
|
this.autoplayKey = this.config.autoplay;
|
|
17564
17562
|
this.play(this.autoplayKey);
|
|
17565
17563
|
this.autoplay = this.sounds[this.autoplayKey];
|
|
@@ -17802,21 +17800,21 @@ var SoundManager = class {
|
|
|
17802
17800
|
*/
|
|
17803
17801
|
stopAll() {
|
|
17804
17802
|
if (this.noAudio) return;
|
|
17805
|
-
for (const sound of this._sounds) if (sound) sound.stop();
|
|
17803
|
+
for (const sound of this._sounds) if (sound !== null) sound.stop();
|
|
17806
17804
|
}
|
|
17807
17805
|
/**
|
|
17808
17806
|
* Pauses all sounds in the manager.
|
|
17809
17807
|
*/
|
|
17810
17808
|
pauseAll() {
|
|
17811
17809
|
if (this.noAudio) return;
|
|
17812
|
-
for (const sound of this._sounds) if (sound) sound.pause();
|
|
17810
|
+
for (const sound of this._sounds) if (sound !== null) sound.pause();
|
|
17813
17811
|
}
|
|
17814
17812
|
/**
|
|
17815
17813
|
* Resumes all sounds in the manager.
|
|
17816
17814
|
*/
|
|
17817
17815
|
resumeAll() {
|
|
17818
17816
|
if (this.noAudio) return;
|
|
17819
|
-
for (const sound of this._sounds) if (sound) sound.resume();
|
|
17817
|
+
for (const sound of this._sounds) if (sound !== null) sound.resume();
|
|
17820
17818
|
}
|
|
17821
17819
|
/**
|
|
17822
17820
|
* Decodes an audio file for playback.
|
|
@@ -17852,7 +17850,7 @@ var SoundManager = class {
|
|
|
17852
17850
|
this._watchList.reset();
|
|
17853
17851
|
for (const file of candidates) {
|
|
17854
17852
|
const key = file instanceof Sound ? file.key : file;
|
|
17855
|
-
if (
|
|
17853
|
+
if (this.game.cache.isSoundDecoded(key) !== true) this._watchList.add(key);
|
|
17856
17854
|
}
|
|
17857
17855
|
if (this._watchList.total === 0) {
|
|
17858
17856
|
this._watching = false;
|
|
@@ -17871,8 +17869,8 @@ var SoundManager = class {
|
|
|
17871
17869
|
for (const sound of this._sounds) sound.update();
|
|
17872
17870
|
if (this._watching) {
|
|
17873
17871
|
let key = this._watchList.first;
|
|
17874
|
-
while (key) {
|
|
17875
|
-
if (this.game.cache.isSoundDecoded(key)) this._watchList.remove(key);
|
|
17872
|
+
while (key !== null) {
|
|
17873
|
+
if (this.game.cache.isSoundDecoded(key) === true) this._watchList.remove(key);
|
|
17876
17874
|
key = this._watchList.next;
|
|
17877
17875
|
}
|
|
17878
17876
|
if (this._watchList.total === 0) {
|
|
@@ -17977,7 +17975,7 @@ var SoundManager = class {
|
|
|
17977
17975
|
*/
|
|
17978
17976
|
destroy() {
|
|
17979
17977
|
this.stopAll();
|
|
17980
|
-
for (const sound of this._sounds) if (sound) sound.destroy();
|
|
17978
|
+
for (const sound of this._sounds) if (sound !== null) sound.destroy();
|
|
17981
17979
|
this._sounds = [];
|
|
17982
17980
|
this.onChange.dispose();
|
|
17983
17981
|
if (this.context?.close) this.context.close();
|
|
@@ -18014,11 +18012,10 @@ var SoundManager = class {
|
|
|
18014
18012
|
* Sets the volume level of the sound manager.
|
|
18015
18013
|
*/
|
|
18016
18014
|
set volume(value) {
|
|
18017
|
-
|
|
18018
|
-
|
|
18019
|
-
|
|
18020
|
-
this.
|
|
18021
|
-
if (!this.noAudio) this.masterGain.gain.value = value;
|
|
18015
|
+
const level = Math.min(1, Math.max(0, value));
|
|
18016
|
+
if (this._volume !== level) {
|
|
18017
|
+
this._volume = level;
|
|
18018
|
+
if (!this.noAudio) this.masterGain.gain.value = level;
|
|
18022
18019
|
}
|
|
18023
18020
|
}
|
|
18024
18021
|
};
|
|
@@ -18044,15 +18041,15 @@ var Stage = class extends DisplayObject {
|
|
|
18044
18041
|
color: 0,
|
|
18045
18042
|
rgba: "#000000"
|
|
18046
18043
|
};
|
|
18047
|
-
if (
|
|
18048
|
-
if (game.config.backgroundColor &&
|
|
18044
|
+
if (game.config.transparent === false) this._bgColor.a = 1;
|
|
18045
|
+
if (game.config.backgroundColor !== 0 && this.game.config.transparent === false) this.setBackgroundColor(game.config.backgroundColor);
|
|
18049
18046
|
}
|
|
18050
18047
|
/**
|
|
18051
18048
|
* Sets the background color of the stage.
|
|
18052
18049
|
* @param {number} color - The color to set as the background.
|
|
18053
18050
|
*/
|
|
18054
18051
|
setBackgroundColor(color) {
|
|
18055
|
-
if (this.game.config.transparent) return;
|
|
18052
|
+
if (this.game.config.transparent !== false) return;
|
|
18056
18053
|
valueToColor(color, this._bgColor);
|
|
18057
18054
|
this._bgColor.r /= 255;
|
|
18058
18055
|
this._bgColor.g /= 255;
|
|
@@ -18334,7 +18331,7 @@ var Timer = class {
|
|
|
18334
18331
|
this._i = this.events.length;
|
|
18335
18332
|
while (this._i) {
|
|
18336
18333
|
this._i -= 1;
|
|
18337
|
-
if (this.events[this._i]?.pendingDelete) this.events.splice(this._i, 1);
|
|
18334
|
+
if (this.events[this._i]?.pendingDelete === true) this.events.splice(this._i, 1);
|
|
18338
18335
|
}
|
|
18339
18336
|
this._len = this.events.length;
|
|
18340
18337
|
this._i = 0;
|
|
@@ -19093,8 +19090,7 @@ var Tween = class {
|
|
|
19093
19090
|
for (const tweenData of this.timeline) tweenData.loadValues();
|
|
19094
19091
|
this.manager.add(this);
|
|
19095
19092
|
this.isRunning = true;
|
|
19096
|
-
|
|
19097
|
-
this.current = index;
|
|
19093
|
+
this.current = index < 0 || index > this.timeline.length - 1 ? 0 : index;
|
|
19098
19094
|
this.timeline[this.current].start();
|
|
19099
19095
|
return this;
|
|
19100
19096
|
}
|
|
@@ -19194,8 +19190,7 @@ var Tween = class {
|
|
|
19194
19190
|
* @returns {Tween} This Tween object for chaining.
|
|
19195
19191
|
*/
|
|
19196
19192
|
easing(ease, index) {
|
|
19197
|
-
|
|
19198
|
-
return this.updateTweenData("easingFunction", ease, index);
|
|
19193
|
+
return this.updateTweenData("easingFunction", this.resolveEasing(ease), index);
|
|
19199
19194
|
}
|
|
19200
19195
|
/**
|
|
19201
19196
|
* Sets the interpolation function for a timeline entry.
|
|
@@ -19359,8 +19354,9 @@ var Tween = class {
|
|
|
19359
19354
|
}
|
|
19360
19355
|
}
|
|
19361
19356
|
for (const tweenData of this.timeline) tweenData.loadValues();
|
|
19362
|
-
|
|
19363
|
-
|
|
19357
|
+
const frames = [...data];
|
|
19358
|
+
for (const tweenData of this.timeline) frames.push(...tweenData.generateData(frameRate));
|
|
19359
|
+
return frames;
|
|
19364
19360
|
}
|
|
19365
19361
|
/**
|
|
19366
19362
|
* Gets the total duration of all timeline entries.
|
|
@@ -19966,8 +19962,8 @@ var Game = class {
|
|
|
19966
19962
|
this.input.boot();
|
|
19967
19963
|
this.sound.boot();
|
|
19968
19964
|
this.state.boot();
|
|
19969
|
-
if (window.focus) window.focus();
|
|
19970
|
-
if (
|
|
19965
|
+
if (typeof window.focus === "function") window.focus();
|
|
19966
|
+
if (this.config.isSkipTicker !== true) {
|
|
19971
19967
|
this.raf = new RequestAnimationFrame(this);
|
|
19972
19968
|
this.raf.start();
|
|
19973
19969
|
}
|
|
@@ -20002,8 +19998,8 @@ var Game = class {
|
|
|
20002
19998
|
isWebGlReady = true;
|
|
20003
19999
|
} catch (error) {
|
|
20004
20000
|
isWebGlReady = false;
|
|
20005
|
-
if (globalThis.PhaserRegistry?.GL_PROGRAM_INFO_LOG) this.logger.warn("WebGL program info", { log: globalThis.PhaserRegistry.GL_PROGRAM_INFO_LOG });
|
|
20006
|
-
if (globalThis.PhaserRegistry?.GL_SHADER_INFO_LOG) this.logger.warn("WebGL shader info", { log: globalThis.PhaserRegistry.GL_SHADER_INFO_LOG });
|
|
20001
|
+
if (globalThis.PhaserRegistry?.GL_PROGRAM_INFO_LOG != null) this.logger.warn("WebGL program info", { log: globalThis.PhaserRegistry.GL_PROGRAM_INFO_LOG });
|
|
20002
|
+
if (globalThis.PhaserRegistry?.GL_SHADER_INFO_LOG != null) this.logger.warn("WebGL shader info", { log: globalThis.PhaserRegistry.GL_SHADER_INFO_LOG });
|
|
20007
20003
|
const typedError = error instanceof Error ? error : new Error(String(error));
|
|
20008
20004
|
this.logger.fatal("Game", { error: typedError });
|
|
20009
20005
|
}
|
|
@@ -20051,7 +20047,7 @@ var Game = class {
|
|
|
20051
20047
|
this.parseConfigElement(config, "renderType", 0);
|
|
20052
20048
|
this.parseConfigElement(config, "isForceDisabledAudio", false);
|
|
20053
20049
|
this.parseConfigElement(config, "maxParallelDownloads", 16);
|
|
20054
|
-
if (config.parent) this.parent = config.parent;
|
|
20050
|
+
if (config.parent !== void 0) this.parent = config.parent;
|
|
20055
20051
|
this.state = new SceneManager(this, config.state ?? null);
|
|
20056
20052
|
}
|
|
20057
20053
|
/**
|