pixi.js 7.2.1 → 7.2.3
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/pixi.js +106 -38
- package/dist/pixi.js.map +1 -1
- package/dist/pixi.min.js +31 -31
- package/dist/pixi.min.js.map +1 -1
- package/dist/pixi.min.mjs +26 -26
- package/dist/pixi.min.mjs.map +1 -1
- package/dist/pixi.mjs +106 -38
- package/dist/pixi.mjs.map +1 -1
- package/package.json +31 -31
package/dist/pixi.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* pixi.js - v7.2.
|
|
3
|
-
* Compiled Fri,
|
|
2
|
+
* pixi.js - v7.2.3
|
|
3
|
+
* Compiled Fri, 24 Mar 2023 19:53:04 UTC
|
|
4
4
|
*
|
|
5
5
|
* pixi.js is licensed under the MIT License.
|
|
6
6
|
* http://www.opensource.org/licenses/mit-license
|
|
@@ -3351,19 +3351,51 @@ Deprecated since v${version}`);
|
|
|
3351
3351
|
}
|
|
3352
3352
|
set value(value) {
|
|
3353
3353
|
if (value instanceof _Color) {
|
|
3354
|
-
this._value = value._value;
|
|
3354
|
+
this._value = this.cloneSource(value._value);
|
|
3355
3355
|
this._int = value._int;
|
|
3356
3356
|
this._components.set(value._components);
|
|
3357
3357
|
} else if (value === null) {
|
|
3358
3358
|
throw new Error("Cannot set PIXI.Color#value to null");
|
|
3359
|
-
} else if (this._value
|
|
3359
|
+
} else if (this._value === null || !this.isSourceEqual(this._value, value)) {
|
|
3360
3360
|
this.normalize(value);
|
|
3361
|
-
this._value = value;
|
|
3361
|
+
this._value = this.cloneSource(value);
|
|
3362
3362
|
}
|
|
3363
3363
|
}
|
|
3364
3364
|
get value() {
|
|
3365
3365
|
return this._value;
|
|
3366
3366
|
}
|
|
3367
|
+
cloneSource(value) {
|
|
3368
|
+
if (typeof value === "string" || typeof value === "number" || value instanceof Number || value === null) {
|
|
3369
|
+
return value;
|
|
3370
|
+
} else if (Array.isArray(value) || ArrayBuffer.isView(value)) {
|
|
3371
|
+
return value.slice(0);
|
|
3372
|
+
} else if (typeof value === "object" && value !== null) {
|
|
3373
|
+
return { ...value };
|
|
3374
|
+
}
|
|
3375
|
+
return value;
|
|
3376
|
+
}
|
|
3377
|
+
isSourceEqual(value1, value2) {
|
|
3378
|
+
const type1 = typeof value1;
|
|
3379
|
+
const type2 = typeof value2;
|
|
3380
|
+
if (type1 !== type2) {
|
|
3381
|
+
return false;
|
|
3382
|
+
} else if (type1 === "number" || type1 === "string" || value1 instanceof Number) {
|
|
3383
|
+
return value1 === value2;
|
|
3384
|
+
} else if (Array.isArray(value1) && Array.isArray(value2) || ArrayBuffer.isView(value1) && ArrayBuffer.isView(value2)) {
|
|
3385
|
+
if (value1.length !== value2.length) {
|
|
3386
|
+
return false;
|
|
3387
|
+
}
|
|
3388
|
+
return value1.every((v, i) => v === value2[i]);
|
|
3389
|
+
} else if (value1 !== null && value2 !== null) {
|
|
3390
|
+
const keys1 = Object.keys(value1);
|
|
3391
|
+
const keys2 = Object.keys(value2);
|
|
3392
|
+
if (keys1.length !== keys2.length) {
|
|
3393
|
+
return false;
|
|
3394
|
+
}
|
|
3395
|
+
return keys1.every((key) => value1[key] === value2[key]);
|
|
3396
|
+
}
|
|
3397
|
+
return value1 === value2;
|
|
3398
|
+
}
|
|
3367
3399
|
toRgba() {
|
|
3368
3400
|
const [r, g, b, a] = this._components;
|
|
3369
3401
|
return { r, g, b, a };
|
|
@@ -3445,16 +3477,14 @@ Deprecated since v${version}`);
|
|
|
3445
3477
|
return this.toHex() + "00".substring(0, 2 - alphaString.length) + alphaString;
|
|
3446
3478
|
}
|
|
3447
3479
|
setAlpha(alpha) {
|
|
3448
|
-
this._components[3] = alpha;
|
|
3480
|
+
this._components[3] = this._clamp(alpha);
|
|
3449
3481
|
return this;
|
|
3450
3482
|
}
|
|
3451
|
-
round(
|
|
3483
|
+
round(steps) {
|
|
3452
3484
|
const [r, g, b] = this._components;
|
|
3453
|
-
this._components.
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
Math.min(255, b / step * step)
|
|
3457
|
-
]);
|
|
3485
|
+
this._components[0] = Math.round(r * steps) / steps;
|
|
3486
|
+
this._components[1] = Math.round(g * steps) / steps;
|
|
3487
|
+
this._components[2] = Math.round(b * steps) / steps;
|
|
3458
3488
|
this.refreshInt();
|
|
3459
3489
|
this._value = null;
|
|
3460
3490
|
return this;
|
|
@@ -3478,10 +3508,12 @@ Deprecated since v${version}`);
|
|
|
3478
3508
|
(int & 255) / 255,
|
|
3479
3509
|
1
|
|
3480
3510
|
];
|
|
3481
|
-
} else if ((Array.isArray(value) || value instanceof Float32Array) && value.length >= 3 && value.length <= 4
|
|
3511
|
+
} else if ((Array.isArray(value) || value instanceof Float32Array) && value.length >= 3 && value.length <= 4) {
|
|
3512
|
+
value = this._clamp(value);
|
|
3482
3513
|
const [r, g, b, a = 1] = value;
|
|
3483
3514
|
components = [r, g, b, a];
|
|
3484
3515
|
} else if ((value instanceof Uint8Array || value instanceof Uint8ClampedArray) && value.length >= 3 && value.length <= 4) {
|
|
3516
|
+
value = this._clamp(value, 0, 255);
|
|
3485
3517
|
const [r, g, b, a = 255] = value;
|
|
3486
3518
|
components = [r / 255, g / 255, b / 255, a / 255];
|
|
3487
3519
|
} else if (typeof value === "string" || typeof value === "object") {
|
|
@@ -3505,9 +3537,19 @@ Deprecated since v${version}`);
|
|
|
3505
3537
|
}
|
|
3506
3538
|
}
|
|
3507
3539
|
refreshInt() {
|
|
3540
|
+
this._clamp(this._components);
|
|
3508
3541
|
const [r, g, b] = this._components;
|
|
3509
3542
|
this._int = (r * 255 << 16) + (g * 255 << 8) + (b * 255 | 0);
|
|
3510
3543
|
}
|
|
3544
|
+
_clamp(value, min = 0, max = 1) {
|
|
3545
|
+
if (typeof value === "number") {
|
|
3546
|
+
return Math.min(Math.max(value, min), max);
|
|
3547
|
+
}
|
|
3548
|
+
value.forEach((v, i) => {
|
|
3549
|
+
value[i] = Math.min(Math.max(v, min), max);
|
|
3550
|
+
});
|
|
3551
|
+
return value;
|
|
3552
|
+
}
|
|
3511
3553
|
};
|
|
3512
3554
|
let Color = _Color;
|
|
3513
3555
|
Color.shared = new _Color();
|
|
@@ -10358,7 +10400,7 @@ ${this.fragmentSrc}`;
|
|
|
10358
10400
|
const { renderer } = this;
|
|
10359
10401
|
renderer.runners.init.emit(renderer.options);
|
|
10360
10402
|
if (options.hello) {
|
|
10361
|
-
console.log(`PixiJS ${"7.2.
|
|
10403
|
+
console.log(`PixiJS ${"7.2.3"} - ${renderer.rendererLogId} - https://pixijs.com`);
|
|
10362
10404
|
}
|
|
10363
10405
|
renderer.resize(renderer.screen.width, renderer.screen.height);
|
|
10364
10406
|
}
|
|
@@ -12544,7 +12586,7 @@ ${this.fragmentSrc}`;
|
|
|
12544
12586
|
}
|
|
12545
12587
|
}
|
|
12546
12588
|
|
|
12547
|
-
const VERSION = "7.2.
|
|
12589
|
+
const VERSION = "7.2.3";
|
|
12548
12590
|
|
|
12549
12591
|
class Bounds {
|
|
12550
12592
|
constructor() {
|
|
@@ -15136,7 +15178,7 @@ ${this.fragmentSrc}`;
|
|
|
15136
15178
|
this.eventPool = /* @__PURE__ */ new Map();
|
|
15137
15179
|
this._allInteractiveElements = [];
|
|
15138
15180
|
this._hitElements = [];
|
|
15139
|
-
this.
|
|
15181
|
+
this._isPointerMoveEvent = false;
|
|
15140
15182
|
this.rootTarget = rootTarget;
|
|
15141
15183
|
this.hitPruneFn = this.hitPruneFn.bind(this);
|
|
15142
15184
|
this.hitTestFn = this.hitTestFn.bind(this);
|
|
@@ -15188,7 +15230,9 @@ ${this.fragmentSrc}`;
|
|
|
15188
15230
|
}
|
|
15189
15231
|
hitTest(x, y) {
|
|
15190
15232
|
EventsTicker.pauseUpdate = true;
|
|
15191
|
-
const
|
|
15233
|
+
const useMove = this._isPointerMoveEvent && this.enableGlobalMoveEvents;
|
|
15234
|
+
const fn = useMove ? "hitTestMoveRecursive" : "hitTestRecursive";
|
|
15235
|
+
const invertedPath = this[fn](this.rootTarget, this.rootTarget.eventMode, tempHitLocation.set(x, y), this.hitTestFn, this.hitPruneFn);
|
|
15192
15236
|
return invertedPath && invertedPath[0];
|
|
15193
15237
|
}
|
|
15194
15238
|
propagate(e, type) {
|
|
@@ -15240,10 +15284,9 @@ ${this.fragmentSrc}`;
|
|
|
15240
15284
|
propagationPath.reverse();
|
|
15241
15285
|
return propagationPath;
|
|
15242
15286
|
}
|
|
15243
|
-
|
|
15244
|
-
if (
|
|
15287
|
+
hitTestMoveRecursive(currentTarget, eventMode, location, testFn, pruneFn, ignore = false) {
|
|
15288
|
+
if (this._interactivePrune(currentTarget))
|
|
15245
15289
|
return null;
|
|
15246
|
-
}
|
|
15247
15290
|
if (currentTarget.eventMode === "dynamic" || eventMode === "dynamic") {
|
|
15248
15291
|
EventsTicker.pauseUpdate = false;
|
|
15249
15292
|
}
|
|
@@ -15251,34 +15294,58 @@ ${this.fragmentSrc}`;
|
|
|
15251
15294
|
const children = currentTarget.children;
|
|
15252
15295
|
for (let i = children.length - 1; i >= 0; i--) {
|
|
15253
15296
|
const child = children[i];
|
|
15254
|
-
const nestedHit = this.
|
|
15297
|
+
const nestedHit = this.hitTestMoveRecursive(child, this._isInteractive(eventMode) ? eventMode : child.eventMode, location, testFn, pruneFn, pruneFn(currentTarget, location));
|
|
15255
15298
|
if (nestedHit) {
|
|
15256
15299
|
if (nestedHit.length > 0 && !nestedHit[nestedHit.length - 1].parent) {
|
|
15257
15300
|
continue;
|
|
15258
15301
|
}
|
|
15259
15302
|
const isInteractive = currentTarget.isInteractive();
|
|
15260
15303
|
if (nestedHit.length > 0 || isInteractive) {
|
|
15261
|
-
if (
|
|
15304
|
+
if (isInteractive)
|
|
15262
15305
|
this._allInteractiveElements.push(currentTarget);
|
|
15263
|
-
}
|
|
15264
15306
|
nestedHit.push(currentTarget);
|
|
15265
15307
|
}
|
|
15266
|
-
if (this.
|
|
15308
|
+
if (this._hitElements.length === 0)
|
|
15267
15309
|
this._hitElements = nestedHit;
|
|
15268
|
-
}
|
|
15269
|
-
if (!this._collectInteractiveElements)
|
|
15270
|
-
return nestedHit;
|
|
15271
15310
|
}
|
|
15272
15311
|
}
|
|
15273
15312
|
}
|
|
15274
15313
|
const isInteractiveMode = this._isInteractive(eventMode);
|
|
15275
15314
|
const isInteractiveTarget = currentTarget.isInteractive();
|
|
15276
|
-
if (
|
|
15277
|
-
|
|
15278
|
-
|
|
15279
|
-
|
|
15280
|
-
|
|
15315
|
+
if (isInteractiveTarget && isInteractiveTarget)
|
|
15316
|
+
this._allInteractiveElements.push(currentTarget);
|
|
15317
|
+
if (ignore || this._hitElements.length > 0)
|
|
15318
|
+
return null;
|
|
15319
|
+
if (isInteractiveMode && (!pruneFn(currentTarget, location) && testFn(currentTarget, location))) {
|
|
15320
|
+
return isInteractiveTarget ? [currentTarget] : [];
|
|
15321
|
+
}
|
|
15322
|
+
return null;
|
|
15323
|
+
}
|
|
15324
|
+
hitTestRecursive(currentTarget, eventMode, location, testFn, pruneFn) {
|
|
15325
|
+
if (this._interactivePrune(currentTarget) || pruneFn(currentTarget, location)) {
|
|
15326
|
+
return null;
|
|
15327
|
+
}
|
|
15328
|
+
if (currentTarget.eventMode === "dynamic" || eventMode === "dynamic") {
|
|
15329
|
+
EventsTicker.pauseUpdate = false;
|
|
15330
|
+
}
|
|
15331
|
+
if (currentTarget.interactiveChildren && currentTarget.children) {
|
|
15332
|
+
const children = currentTarget.children;
|
|
15333
|
+
for (let i = children.length - 1; i >= 0; i--) {
|
|
15334
|
+
const child = children[i];
|
|
15335
|
+
const nestedHit = this.hitTestRecursive(child, this._isInteractive(eventMode) ? eventMode : child.eventMode, location, testFn, pruneFn);
|
|
15336
|
+
if (nestedHit) {
|
|
15337
|
+
if (nestedHit.length > 0 && !nestedHit[nestedHit.length - 1].parent) {
|
|
15338
|
+
continue;
|
|
15339
|
+
}
|
|
15340
|
+
const isInteractive = currentTarget.isInteractive();
|
|
15341
|
+
if (nestedHit.length > 0 || isInteractive)
|
|
15342
|
+
nestedHit.push(currentTarget);
|
|
15343
|
+
return nestedHit;
|
|
15344
|
+
}
|
|
15345
|
+
}
|
|
15281
15346
|
}
|
|
15347
|
+
const isInteractiveMode = this._isInteractive(eventMode);
|
|
15348
|
+
const isInteractiveTarget = currentTarget.isInteractive();
|
|
15282
15349
|
if (isInteractiveMode && testFn(currentTarget, location)) {
|
|
15283
15350
|
return isInteractiveTarget ? [currentTarget] : [];
|
|
15284
15351
|
}
|
|
@@ -15287,7 +15354,7 @@ ${this.fragmentSrc}`;
|
|
|
15287
15354
|
_isInteractive(int) {
|
|
15288
15355
|
return int === "static" || int === "dynamic";
|
|
15289
15356
|
}
|
|
15290
|
-
|
|
15357
|
+
_interactivePrune(displayObject) {
|
|
15291
15358
|
if (!displayObject || displayObject.isMask || !displayObject.visible || !displayObject.renderable) {
|
|
15292
15359
|
return true;
|
|
15293
15360
|
}
|
|
@@ -15300,8 +15367,9 @@ ${this.fragmentSrc}`;
|
|
|
15300
15367
|
if (displayObject.isMask) {
|
|
15301
15368
|
return true;
|
|
15302
15369
|
}
|
|
15303
|
-
|
|
15304
|
-
|
|
15370
|
+
return false;
|
|
15371
|
+
}
|
|
15372
|
+
hitPruneFn(displayObject, location) {
|
|
15305
15373
|
if (displayObject.hitArea) {
|
|
15306
15374
|
displayObject.worldTransform.applyInverse(location, tempLocalMapping);
|
|
15307
15375
|
if (!displayObject.hitArea.contains(tempLocalMapping.x, tempLocalMapping.y)) {
|
|
@@ -15362,9 +15430,9 @@ ${this.fragmentSrc}`;
|
|
|
15362
15430
|
}
|
|
15363
15431
|
this._allInteractiveElements.length = 0;
|
|
15364
15432
|
this._hitElements.length = 0;
|
|
15365
|
-
this.
|
|
15433
|
+
this._isPointerMoveEvent = true;
|
|
15366
15434
|
const e = this.createPointerEvent(from);
|
|
15367
|
-
this.
|
|
15435
|
+
this._isPointerMoveEvent = false;
|
|
15368
15436
|
const isMouse = e.pointerType === "mouse" || e.pointerType === "pen";
|
|
15369
15437
|
const trackingData = this.trackingData(from.pointerId);
|
|
15370
15438
|
const outTarget = this.findMountedTarget(trackingData.overTargets);
|
|
@@ -20406,7 +20474,7 @@ ${e}`);
|
|
|
20406
20474
|
const uniforms = shader.uniforms;
|
|
20407
20475
|
const drawCalls = geometry.drawCalls;
|
|
20408
20476
|
uniforms.translationMatrix = this.transform.worldTransform;
|
|
20409
|
-
Color.shared.setValue(this._tintColor).
|
|
20477
|
+
Color.shared.setValue(this._tintColor).premultiply(worldAlpha).toArray(uniforms.tint);
|
|
20410
20478
|
renderer.shader.bind(shader);
|
|
20411
20479
|
renderer.geometry.bind(geometry, shader);
|
|
20412
20480
|
renderer.state.set(this.state);
|