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.js 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
@@ -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 !== 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 };
@@ -3505,6 +3537,7 @@ Deprecated since v${version}`);
3505
3537
  }
3506
3538
  }
3507
3539
  refreshInt() {
3540
+ this._components.forEach((value, i) => this._components[i] = Math.min(Math.max(value, 0), 1));
3508
3541
  const [r, g, b] = this._components;
3509
3542
  this._int = (r * 255 << 16) + (g * 255 << 8) + (b * 255 | 0);
3510
3543
  }
@@ -10358,7 +10391,7 @@ ${this.fragmentSrc}`;
10358
10391
  const { renderer } = this;
10359
10392
  renderer.runners.init.emit(renderer.options);
10360
10393
  if (options.hello) {
10361
- console.log(`PixiJS ${"7.2.1"} - ${renderer.rendererLogId} - https://pixijs.com`);
10394
+ console.log(`PixiJS ${"7.2.2"} - ${renderer.rendererLogId} - https://pixijs.com`);
10362
10395
  }
10363
10396
  renderer.resize(renderer.screen.width, renderer.screen.height);
10364
10397
  }
@@ -12544,7 +12577,7 @@ ${this.fragmentSrc}`;
12544
12577
  }
12545
12578
  }
12546
12579
 
12547
- const VERSION = "7.2.1";
12580
+ const VERSION = "7.2.2";
12548
12581
 
12549
12582
  class Bounds {
12550
12583
  constructor() {