pixi.js 7.2.1 → 7.2.2

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.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * pixi.js - v7.2.1
3
- * Compiled Fri, 17 Mar 2023 16:54:13 UTC
2
+ * pixi.js - v7.2.2
3
+ * Compiled Tue, 21 Mar 2023 12:27:22 UTC
4
4
  *
5
5
  * pixi.js is licensed under the MIT License.
6
6
  * http://www.opensource.org/licenses/mit-license
@@ -3348,19 +3348,51 @@ const _Color = class {
3348
3348
  }
3349
3349
  set value(value) {
3350
3350
  if (value instanceof _Color) {
3351
- this._value = value._value;
3351
+ this._value = this.cloneSource(value._value);
3352
3352
  this._int = value._int;
3353
3353
  this._components.set(value._components);
3354
3354
  } else if (value === null) {
3355
3355
  throw new Error("Cannot set PIXI.Color#value to null");
3356
- } else if (this._value !== value) {
3356
+ } else if (this._value === null || !this.isSourceEqual(this._value, value)) {
3357
3357
  this.normalize(value);
3358
- this._value = value;
3358
+ this._value = this.cloneSource(value);
3359
3359
  }
3360
3360
  }
3361
3361
  get value() {
3362
3362
  return this._value;
3363
3363
  }
3364
+ cloneSource(value) {
3365
+ if (typeof value === "string" || typeof value === "number" || value instanceof Number || value === null) {
3366
+ return value;
3367
+ } else if (Array.isArray(value) || ArrayBuffer.isView(value)) {
3368
+ return value.slice(0);
3369
+ } else if (typeof value === "object" && value !== null) {
3370
+ return { ...value };
3371
+ }
3372
+ return value;
3373
+ }
3374
+ isSourceEqual(value1, value2) {
3375
+ const type1 = typeof value1;
3376
+ const type2 = typeof value2;
3377
+ if (type1 !== type2) {
3378
+ return false;
3379
+ } else if (type1 === "number" || type1 === "string" || value1 instanceof Number) {
3380
+ return value1 === value2;
3381
+ } else if (Array.isArray(value1) && Array.isArray(value2) || ArrayBuffer.isView(value1) && ArrayBuffer.isView(value2)) {
3382
+ if (value1.length !== value2.length) {
3383
+ return false;
3384
+ }
3385
+ return value1.every((v, i) => v === value2[i]);
3386
+ } else if (value1 !== null && value2 !== null) {
3387
+ const keys1 = Object.keys(value1);
3388
+ const keys2 = Object.keys(value2);
3389
+ if (keys1.length !== keys2.length) {
3390
+ return false;
3391
+ }
3392
+ return keys1.every((key) => value1[key] === value2[key]);
3393
+ }
3394
+ return value1 === value2;
3395
+ }
3364
3396
  toRgba() {
3365
3397
  const [r, g, b, a] = this._components;
3366
3398
  return { r, g, b, a };
@@ -3502,6 +3534,7 @@ const _Color = class {
3502
3534
  }
3503
3535
  }
3504
3536
  refreshInt() {
3537
+ this._components.forEach((value, i) => this._components[i] = Math.min(Math.max(value, 0), 1));
3505
3538
  const [r, g, b] = this._components;
3506
3539
  this._int = (r * 255 << 16) + (g * 255 << 8) + (b * 255 | 0);
3507
3540
  }
@@ -10355,7 +10388,7 @@ class StartupSystem {
10355
10388
  const { renderer } = this;
10356
10389
  renderer.runners.init.emit(renderer.options);
10357
10390
  if (options.hello) {
10358
- console.log(`PixiJS ${"7.2.1"} - ${renderer.rendererLogId} - https://pixijs.com`);
10391
+ console.log(`PixiJS ${"7.2.2"} - ${renderer.rendererLogId} - https://pixijs.com`);
10359
10392
  }
10360
10393
  renderer.resize(renderer.screen.width, renderer.screen.height);
10361
10394
  }
@@ -12541,7 +12574,7 @@ class TransformFeedback {
12541
12574
  }
12542
12575
  }
12543
12576
 
12544
- const VERSION = "7.2.1";
12577
+ const VERSION = "7.2.2";
12545
12578
 
12546
12579
  class Bounds {
12547
12580
  constructor() {