pixi.js 7.0.0-beta.3 → 7.0.0-beta.4

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.
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * pixi.js - v7.0.0-beta.3
3
- * Compiled Thu, 13 Oct 2022 15:35:43 UTC
2
+ * pixi.js - v7.0.0-beta.4
3
+ * Compiled Thu, 20 Oct 2022 19:45:44 UTC
4
4
  *
5
5
  * pixi.js is licensed under the MIT License.
6
6
  * http://www.opensource.org/licenses/mit-license
@@ -9,8 +9,8 @@ var PIXI = (function (exports) {
9
9
  'use strict';
10
10
 
11
11
  /*!
12
- * @pixi/constants - v7.0.0-beta.3
13
- * Compiled Thu, 13 Oct 2022 15:35:43 UTC
12
+ * @pixi/constants - v7.0.0-beta.4
13
+ * Compiled Thu, 20 Oct 2022 19:45:44 UTC
14
14
  *
15
15
  * @pixi/constants is licensed under the MIT License.
16
16
  * http://www.opensource.org/licenses/mit-license
@@ -208,8 +208,8 @@ var PIXI = (function (exports) {
208
208
  })(BUFFER_TYPE || {});
209
209
 
210
210
  /*!
211
- * @pixi/settings - v7.0.0-beta.3
212
- * Compiled Thu, 13 Oct 2022 15:35:43 UTC
211
+ * @pixi/settings - v7.0.0-beta.4
212
+ * Compiled Thu, 20 Oct 2022 19:45:44 UTC
213
213
  *
214
214
  * @pixi/settings is licensed under the MIT License.
215
215
  * http://www.opensource.org/licenses/mit-license
@@ -421,8 +421,8 @@ var PIXI = (function (exports) {
421
421
  };
422
422
 
423
423
  /*!
424
- * @pixi/extensions - v7.0.0-beta.3
425
- * Compiled Thu, 13 Oct 2022 15:35:43 UTC
424
+ * @pixi/extensions - v7.0.0-beta.4
425
+ * Compiled Thu, 20 Oct 2022 19:45:44 UTC
426
426
  *
427
427
  * @pixi/extensions is licensed under the MIT License.
428
428
  * http://www.opensource.org/licenses/mit-license
@@ -520,8 +520,8 @@ var PIXI = (function (exports) {
520
520
  };
521
521
 
522
522
  /*!
523
- * @pixi/math - v7.0.0-beta.3
524
- * Compiled Thu, 13 Oct 2022 15:35:43 UTC
523
+ * @pixi/math - v7.0.0-beta.4
524
+ * Compiled Thu, 20 Oct 2022 19:45:44 UTC
525
525
  *
526
526
  * @pixi/math is licensed under the MIT License.
527
527
  * http://www.opensource.org/licenses/mit-license
@@ -1319,8 +1319,8 @@ var PIXI = (function (exports) {
1319
1319
  Transform.IDENTITY = new _Transform();
1320
1320
 
1321
1321
  /*!
1322
- * @pixi/runner - v7.0.0-beta.3
1323
- * Compiled Thu, 13 Oct 2022 15:35:43 UTC
1322
+ * @pixi/runner - v7.0.0-beta.4
1323
+ * Compiled Thu, 20 Oct 2022 19:45:44 UTC
1324
1324
  *
1325
1325
  * @pixi/runner is licensed under the MIT License.
1326
1326
  * http://www.opensource.org/licenses/mit-license
@@ -1393,8 +1393,8 @@ var PIXI = (function (exports) {
1393
1393
  });
1394
1394
 
1395
1395
  /*!
1396
- * @pixi/ticker - v7.0.0-beta.3
1397
- * Compiled Thu, 13 Oct 2022 15:35:43 UTC
1396
+ * @pixi/ticker - v7.0.0-beta.4
1397
+ * Compiled Thu, 20 Oct 2022 19:45:44 UTC
1398
1398
  *
1399
1399
  * @pixi/ticker is licensed under the MIT License.
1400
1400
  * http://www.opensource.org/licenses/mit-license
@@ -4210,8 +4210,8 @@ var PIXI = (function (exports) {
4210
4210
  };
4211
4211
 
4212
4212
  /*!
4213
- * @pixi/utils - v7.0.0-beta.3
4214
- * Compiled Thu, 13 Oct 2022 15:35:43 UTC
4213
+ * @pixi/utils - v7.0.0-beta.4
4214
+ * Compiled Thu, 20 Oct 2022 19:45:44 UTC
4215
4215
  *
4216
4216
  * @pixi/utils is licensed under the MIT License.
4217
4217
  * http://www.opensource.org/licenses/mit-license
@@ -5241,7 +5241,9 @@ Deprecated since v${version}`);
5241
5241
  function trimCanvas(canvas) {
5242
5242
  let width = canvas.width;
5243
5243
  let height = canvas.height;
5244
- const context = canvas.getContext("2d");
5244
+ const context = canvas.getContext("2d", {
5245
+ willReadFrequently: true
5246
+ });
5245
5247
  const imageData = context.getImageData(0, 0, width, height);
5246
5248
  const pixels = imageData.data;
5247
5249
  const len = pixels.length;
@@ -5376,8 +5378,8 @@ Deprecated since v${version}`);
5376
5378
  };
5377
5379
 
5378
5380
  /*!
5379
- * @pixi/core - v7.0.0-beta.3
5380
- * Compiled Thu, 13 Oct 2022 15:35:43 UTC
5381
+ * @pixi/core - v7.0.0-beta.4
5382
+ * Compiled Thu, 20 Oct 2022 19:45:44 UTC
5381
5383
  *
5382
5384
  * @pixi/core is licensed under the MIT License.
5383
5385
  * http://www.opensource.org/licenses/mit-license
@@ -6331,11 +6333,11 @@ Deprecated since v${version}`);
6331
6333
  }
6332
6334
  _isSourcePlaying() {
6333
6335
  const source = this.source;
6334
- return source.currentTime > 0 && source.paused === false && source.ended === false && source.readyState > 2;
6336
+ return !source.paused && !source.ended && this._isSourceReady();
6335
6337
  }
6336
6338
  _isSourceReady() {
6337
6339
  const source = this.source;
6338
- return source.readyState === 3 || source.readyState === 4;
6340
+ return source.readyState > 2;
6339
6341
  }
6340
6342
  _onPlayStart() {
6341
6343
  if (!this.valid) {
@@ -8180,10 +8182,6 @@ Deprecated since v${version}`);
8180
8182
  resizeFramebuffer(framebuffer) {
8181
8183
  const { gl } = this;
8182
8184
  const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];
8183
- if (fbo.msaaBuffer) {
8184
- gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.msaaBuffer);
8185
- gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample, gl.RGBA8, framebuffer.width, framebuffer.height);
8186
- }
8187
8185
  if (fbo.stencil) {
8188
8186
  gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.stencil);
8189
8187
  if (fbo.msaaBuffer) {
@@ -8201,6 +8199,10 @@ Deprecated since v${version}`);
8201
8199
  const texture = colorTextures[i];
8202
8200
  const parentTexture = texture.parentTextureArray || texture;
8203
8201
  this.renderer.texture.bind(parentTexture, 0);
8202
+ if (i === 0 && fbo.msaaBuffer) {
8203
+ gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.msaaBuffer);
8204
+ gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample, parentTexture._glTextures[this.CONTEXT_UID].internalFormat, framebuffer.width, framebuffer.height);
8205
+ }
8204
8206
  }
8205
8207
  if (framebuffer.depthTexture && this.writeDepthTexture) {
8206
8208
  this.renderer.texture.bind(framebuffer.depthTexture, 0);
@@ -8216,9 +8218,6 @@ Deprecated since v${version}`);
8216
8218
  }
8217
8219
  if (fbo.multisample > 1 && this.canMultisampleFramebuffer(framebuffer)) {
8218
8220
  fbo.msaaBuffer = fbo.msaaBuffer || gl.createRenderbuffer();
8219
- gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.msaaBuffer);
8220
- gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample, gl.RGBA8, framebuffer.width, framebuffer.height);
8221
- gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, fbo.msaaBuffer);
8222
8221
  } else if (fbo.msaaBuffer) {
8223
8222
  gl.deleteRenderbuffer(fbo.msaaBuffer);
8224
8223
  fbo.msaaBuffer = null;
@@ -8233,10 +8232,13 @@ Deprecated since v${version}`);
8233
8232
  const parentTexture = texture.parentTextureArray || texture;
8234
8233
  this.renderer.texture.bind(parentTexture, 0);
8235
8234
  if (i === 0 && fbo.msaaBuffer) {
8236
- continue;
8235
+ gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.msaaBuffer);
8236
+ gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample, parentTexture._glTextures[this.CONTEXT_UID].internalFormat, framebuffer.width, framebuffer.height);
8237
+ gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, fbo.msaaBuffer);
8238
+ } else {
8239
+ gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0 + i, texture.target, parentTexture._glTextures[this.CONTEXT_UID].texture, mipLevel);
8240
+ activeTextures.push(gl.COLOR_ATTACHMENT0 + i);
8237
8241
  }
8238
- gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0 + i, texture.target, parentTexture._glTextures[this.CONTEXT_UID].texture, mipLevel);
8239
- activeTextures.push(gl.COLOR_ATTACHMENT0 + i);
8240
8242
  }
8241
8243
  if (activeTextures.length > 1) {
8242
8244
  gl.drawBuffers(activeTextures);
@@ -9443,6 +9445,7 @@ ${this.fragmentSrc}`;
9443
9445
  } else {
9444
9446
  this.uniformGroup = new UniformGroup({});
9445
9447
  }
9448
+ this.disposeRunner = new Runner("disposeShader");
9446
9449
  }
9447
9450
  checkUniformExists(name, group) {
9448
9451
  if (group.uniforms[name]) {
@@ -9460,6 +9463,8 @@ ${this.fragmentSrc}`;
9460
9463
  }
9461
9464
  destroy() {
9462
9465
  this.uniformGroup = null;
9466
+ this.disposeRunner.emit(this);
9467
+ this.disposeRunner.destroy();
9463
9468
  }
9464
9469
  get uniforms() {
9465
9470
  return this.uniformGroup.uniforms;
@@ -10542,6 +10547,7 @@ ${this.fragmentSrc}`;
10542
10547
  this.reset();
10543
10548
  }
10544
10549
  bind(shader, dontSync) {
10550
+ shader.disposeRunner.add(this);
10545
10551
  shader.uniforms.globals = this.renderer.globalUniforms;
10546
10552
  const program = shader.program;
10547
10553
  const glProgram = program.glPrograms[this.renderer.CONTEXT_UID] || this.generateProgram(shader);
@@ -10638,6 +10644,11 @@ ${this.fragmentSrc}`;
10638
10644
  this.program = null;
10639
10645
  this.shader = null;
10640
10646
  }
10647
+ disposeShader(shader) {
10648
+ if (this.shader === shader) {
10649
+ this.shader = null;
10650
+ }
10651
+ }
10641
10652
  destroy() {
10642
10653
  this.renderer = null;
10643
10654
  this.destroyed = true;
@@ -11469,7 +11480,7 @@ ${this.fragmentSrc}`;
11469
11480
  const renderer = this.renderer;
11470
11481
  renderer.emitWithCustomOptions(renderer.runners.init, options);
11471
11482
  if (options.hello) {
11472
- console.log(`PixiJS ${"7.0.0-beta.3"} - ${renderer.rendererLogId} - https://pixijs.com`);
11483
+ console.log(`PixiJS ${"7.0.0-beta.4"} - ${renderer.rendererLogId} - https://pixijs.com`);
11473
11484
  }
11474
11485
  renderer.resize(this.renderer.screen.width, this.renderer.screen.height);
11475
11486
  }
@@ -12446,11 +12457,11 @@ ${this.fragmentSrc}`;
12446
12457
  };
12447
12458
  extensions$1.add(ObjectRendererSystem);
12448
12459
 
12449
- const VERSION = "7.0.0-beta.3";
12460
+ const VERSION = "7.0.0-beta.4";
12450
12461
 
12451
12462
  /*!
12452
- * @pixi/filter-alpha - v7.0.0-beta.3
12453
- * Compiled Thu, 13 Oct 2022 15:35:43 UTC
12463
+ * @pixi/filter-alpha - v7.0.0-beta.4
12464
+ * Compiled Thu, 20 Oct 2022 19:45:44 UTC
12454
12465
  *
12455
12466
  * @pixi/filter-alpha is licensed under the MIT License.
12456
12467
  * http://www.opensource.org/licenses/mit-license
@@ -12472,8 +12483,8 @@ ${this.fragmentSrc}`;
12472
12483
  }
12473
12484
 
12474
12485
  /*!
12475
- * @pixi/filter-blur - v7.0.0-beta.3
12476
- * Compiled Thu, 13 Oct 2022 15:35:43 UTC
12486
+ * @pixi/filter-blur - v7.0.0-beta.4
12487
+ * Compiled Thu, 20 Oct 2022 19:45:44 UTC
12477
12488
  *
12478
12489
  * @pixi/filter-blur is licensed under the MIT License.
12479
12490
  * http://www.opensource.org/licenses/mit-license
@@ -12710,8 +12721,8 @@ ${this.fragmentSrc}`;
12710
12721
  }
12711
12722
 
12712
12723
  /*!
12713
- * @pixi/filter-color-matrix - v7.0.0-beta.3
12714
- * Compiled Thu, 13 Oct 2022 15:35:43 UTC
12724
+ * @pixi/filter-color-matrix - v7.0.0-beta.4
12725
+ * Compiled Thu, 20 Oct 2022 19:45:44 UTC
12715
12726
  *
12716
12727
  * @pixi/filter-color-matrix is licensed under the MIT License.
12717
12728
  * http://www.opensource.org/licenses/mit-license
@@ -13340,8 +13351,8 @@ ${this.fragmentSrc}`;
13340
13351
  ColorMatrixFilter.prototype.grayscale = ColorMatrixFilter.prototype.greyscale;
13341
13352
 
13342
13353
  /*!
13343
- * @pixi/filter-displacement - v7.0.0-beta.3
13344
- * Compiled Thu, 13 Oct 2022 15:35:43 UTC
13354
+ * @pixi/filter-displacement - v7.0.0-beta.4
13355
+ * Compiled Thu, 20 Oct 2022 19:45:44 UTC
13345
13356
  *
13346
13357
  * @pixi/filter-displacement is licensed under the MIT License.
13347
13358
  * http://www.opensource.org/licenses/mit-license
@@ -13392,8 +13403,8 @@ ${this.fragmentSrc}`;
13392
13403
  }
13393
13404
 
13394
13405
  /*!
13395
- * @pixi/filter-fxaa - v7.0.0-beta.3
13396
- * Compiled Thu, 13 Oct 2022 15:35:43 UTC
13406
+ * @pixi/filter-fxaa - v7.0.0-beta.4
13407
+ * Compiled Thu, 20 Oct 2022 19:45:44 UTC
13397
13408
  *
13398
13409
  * @pixi/filter-fxaa is licensed under the MIT License.
13399
13410
  * http://www.opensource.org/licenses/mit-license
@@ -13410,8 +13421,8 @@ ${this.fragmentSrc}`;
13410
13421
  }
13411
13422
 
13412
13423
  /*!
13413
- * @pixi/filter-noise - v7.0.0-beta.3
13414
- * Compiled Thu, 13 Oct 2022 15:35:43 UTC
13424
+ * @pixi/filter-noise - v7.0.0-beta.4
13425
+ * Compiled Thu, 20 Oct 2022 19:45:44 UTC
13415
13426
  *
13416
13427
  * @pixi/filter-noise is licensed under the MIT License.
13417
13428
  * http://www.opensource.org/licenses/mit-license
@@ -13443,8 +13454,8 @@ ${this.fragmentSrc}`;
13443
13454
  }
13444
13455
 
13445
13456
  /*!
13446
- * @pixi/display - v7.0.0-beta.3
13447
- * Compiled Thu, 13 Oct 2022 15:35:43 UTC
13457
+ * @pixi/display - v7.0.0-beta.4
13458
+ * Compiled Thu, 20 Oct 2022 19:45:44 UTC
13448
13459
  *
13449
13460
  * @pixi/display is licensed under the MIT License.
13450
13461
  * http://www.opensource.org/licenses/mit-license
@@ -14307,8 +14318,8 @@ ${this.fragmentSrc}`;
14307
14318
  Container.prototype.containerUpdateTransform = Container.prototype.updateTransform;
14308
14319
 
14309
14320
  /*!
14310
- * @pixi/sprite - v7.0.0-beta.3
14311
- * Compiled Thu, 13 Oct 2022 15:35:43 UTC
14321
+ * @pixi/sprite - v7.0.0-beta.4
14322
+ * Compiled Thu, 20 Oct 2022 19:45:44 UTC
14312
14323
  *
14313
14324
  * @pixi/sprite is licensed under the MIT License.
14314
14325
  * http://www.opensource.org/licenses/mit-license
@@ -14566,8 +14577,8 @@ ${this.fragmentSrc}`;
14566
14577
  }
14567
14578
 
14568
14579
  /*!
14569
- * @pixi/mixin-cache-as-bitmap - v7.0.0-beta.3
14570
- * Compiled Thu, 13 Oct 2022 15:35:43 UTC
14580
+ * @pixi/mixin-cache-as-bitmap - v7.0.0-beta.4
14581
+ * Compiled Thu, 20 Oct 2022 19:45:44 UTC
14571
14582
  *
14572
14583
  * @pixi/mixin-cache-as-bitmap is licensed under the MIT License.
14573
14584
  * http://www.opensource.org/licenses/mit-license
@@ -14813,8 +14824,8 @@ ${this.fragmentSrc}`;
14813
14824
  };
14814
14825
 
14815
14826
  /*!
14816
- * @pixi/mixin-get-child-by-name - v7.0.0-beta.3
14817
- * Compiled Thu, 13 Oct 2022 15:35:43 UTC
14827
+ * @pixi/mixin-get-child-by-name - v7.0.0-beta.4
14828
+ * Compiled Thu, 20 Oct 2022 19:45:44 UTC
14818
14829
  *
14819
14830
  * @pixi/mixin-get-child-by-name is licensed under the MIT License.
14820
14831
  * http://www.opensource.org/licenses/mit-license
@@ -14843,8 +14854,8 @@ ${this.fragmentSrc}`;
14843
14854
  };
14844
14855
 
14845
14856
  /*!
14846
- * @pixi/mixin-get-global-position - v7.0.0-beta.3
14847
- * Compiled Thu, 13 Oct 2022 15:35:43 UTC
14857
+ * @pixi/mixin-get-global-position - v7.0.0-beta.4
14858
+ * Compiled Thu, 20 Oct 2022 19:45:44 UTC
14848
14859
  *
14849
14860
  * @pixi/mixin-get-global-position is licensed under the MIT License.
14850
14861
  * http://www.opensource.org/licenses/mit-license
@@ -14861,8 +14872,8 @@ ${this.fragmentSrc}`;
14861
14872
  };
14862
14873
 
14863
14874
  /*!
14864
- * @pixi/events - v7.0.0-beta.3
14865
- * Compiled Thu, 13 Oct 2022 15:35:43 UTC
14875
+ * @pixi/events - v7.0.0-beta.4
14876
+ * Compiled Thu, 20 Oct 2022 19:45:44 UTC
14866
14877
  *
14867
14878
  * @pixi/events is licensed under the MIT License.
14868
14879
  * http://www.opensource.org/licenses/mit-license
@@ -15946,8 +15957,8 @@ ${this.fragmentSrc}`;
15946
15957
  DisplayObject.mixin(FederatedDisplayObject);
15947
15958
 
15948
15959
  /*!
15949
- * @pixi/accessibility - v7.0.0-beta.3
15950
- * Compiled Thu, 13 Oct 2022 15:35:43 UTC
15960
+ * @pixi/accessibility - v7.0.0-beta.4
15961
+ * Compiled Thu, 20 Oct 2022 19:45:44 UTC
15951
15962
  *
15952
15963
  * @pixi/accessibility is licensed under the MIT License.
15953
15964
  * http://www.opensource.org/licenses/mit-license
@@ -16251,8 +16262,8 @@ ${this.fragmentSrc}`;
16251
16262
  extensions$1.add(AccessibilityManager);
16252
16263
 
16253
16264
  /*!
16254
- * @pixi/app - v7.0.0-beta.3
16255
- * Compiled Thu, 13 Oct 2022 15:35:43 UTC
16265
+ * @pixi/app - v7.0.0-beta.4
16266
+ * Compiled Thu, 20 Oct 2022 19:45:44 UTC
16256
16267
  *
16257
16268
  * @pixi/app is licensed under the MIT License.
16258
16269
  * http://www.opensource.org/licenses/mit-license
@@ -16356,8 +16367,8 @@ ${this.fragmentSrc}`;
16356
16367
  extensions$1.add(ResizePlugin);
16357
16368
 
16358
16369
  /*!
16359
- * @pixi/assets - v7.0.0-beta.3
16360
- * Compiled Thu, 13 Oct 2022 15:35:43 UTC
16370
+ * @pixi/assets - v7.0.0-beta.4
16371
+ * Compiled Thu, 20 Oct 2022 19:45:44 UTC
16361
16372
  *
16362
16373
  * @pixi/assets is licensed under the MIT License.
16363
16374
  * http://www.opensource.org/licenses/mit-license
@@ -17131,33 +17142,69 @@ ${e}`);
17131
17142
 
17132
17143
  let UUID = 0;
17133
17144
  let MAX_WORKERS;
17145
+ const WHITE_PNG = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=";
17146
+ const checkImageBitmapCode = {
17147
+ id: "checkImageBitmap",
17148
+ code: `
17149
+ async function checkImageBitmap()
17150
+ {
17151
+ try
17152
+ {
17153
+ if (typeof createImageBitmap !== 'function') return false;
17154
+
17155
+ const response = await fetch('${WHITE_PNG}');
17156
+ const imageBlob = await response.blob();
17157
+ const imageBitmap = await createImageBitmap(imageBlob);
17158
+
17159
+ return imageBitmap.width === 1 && imageBitmap.height === 1;
17160
+ }
17161
+ catch (e)
17162
+ {
17163
+ return false;
17164
+ }
17165
+ }
17166
+ checkImageBitmap().then((result) => { self.postMessage(result); });
17167
+ `
17168
+ };
17134
17169
  const workerCode = {
17135
17170
  id: "loadImageBitmap",
17136
17171
  code: `
17137
- self.onmessage = function(event) {
17172
+ async function loadImageBitmap(url)
17173
+ {
17174
+ const response = await fetch(url);
17138
17175
 
17139
- async function loadImageBitmap(url)
17176
+ if (!response.ok)
17140
17177
  {
17141
- const response = await fetch(url);
17142
- const imageBlob = await response.blob();
17143
- const imageBitmap = await createImageBitmap(imageBlob);
17144
- return imageBitmap;
17178
+ throw new Error(\`[WorkerManager.loadImageBitmap] Failed to fetch \${url}: \`
17179
+ + \`\${response.status} \${response.statusText}\`);
17145
17180
  }
17146
17181
 
17147
- loadImageBitmap(event.data.data[0]).then(imageBitmap => {
17182
+ const imageBlob = await response.blob();
17183
+ const imageBitmap = await createImageBitmap(imageBlob);
17184
+
17185
+ return imageBitmap;
17186
+ }
17187
+ self.onmessage = async (event) =>
17188
+ {
17189
+ try
17190
+ {
17191
+ const imageBitmap = await loadImageBitmap(event.data.data[0]);
17192
+
17148
17193
  self.postMessage({
17149
17194
  data: imageBitmap,
17150
17195
  uuid: event.data.uuid,
17151
17196
  id: event.data.id,
17152
17197
  }, [imageBitmap]);
17153
- }).catch(error => {
17198
+ }
17199
+ catch(e)
17200
+ {
17154
17201
  self.postMessage({
17155
- data: null,
17202
+ error: e,
17156
17203
  uuid: event.data.uuid,
17157
17204
  id: event.data.id,
17158
17205
  });
17159
- });
17160
- }`
17206
+ }
17207
+ };`
17161
17208
  };
17162
17209
  let workerURL;
17163
17210
  class WorkerManagerClass {
@@ -17168,6 +17215,20 @@ ${e}`);
17168
17215
  this.queue = [];
17169
17216
  this.resolveHash = {};
17170
17217
  }
17218
+ isImageBitmapSupported() {
17219
+ if (this._isImageBitmapSupported !== void 0)
17220
+ return this._isImageBitmapSupported;
17221
+ this._isImageBitmapSupported = new Promise((resolve) => {
17222
+ const workerURL2 = URL.createObjectURL(new Blob([checkImageBitmapCode.code], { type: "application/javascript" }));
17223
+ const worker = new Worker(workerURL2);
17224
+ worker.addEventListener("message", (event) => {
17225
+ worker.terminate();
17226
+ URL.revokeObjectURL(workerURL2);
17227
+ resolve(event.data);
17228
+ });
17229
+ });
17230
+ return this._isImageBitmapSupported;
17231
+ }
17171
17232
  loadImageBitmap(src) {
17172
17233
  return this._run("loadImageBitmap", [src]);
17173
17234
  }
@@ -17199,14 +17260,17 @@ ${e}`);
17199
17260
  this.workerPool.push(worker);
17200
17261
  }
17201
17262
  complete(data) {
17202
- const result = data.data;
17203
- this.resolveHash[data.uuid](result);
17263
+ if (data.error !== void 0) {
17264
+ this.resolveHash[data.uuid].reject(data.error);
17265
+ } else {
17266
+ this.resolveHash[data.uuid].resolve(data.data);
17267
+ }
17204
17268
  this.resolveHash[data.uuid] = null;
17205
17269
  }
17206
- _run(id, args) {
17207
- this._initWorkers();
17208
- const promise = new Promise((resolve) => {
17209
- this.queue.push({ id, arguments: args, resolve });
17270
+ async _run(id, args) {
17271
+ await this._initWorkers();
17272
+ const promise = new Promise((resolve, reject) => {
17273
+ this.queue.push({ id, arguments: args, resolve, reject });
17210
17274
  });
17211
17275
  this.next();
17212
17276
  return promise;
@@ -17220,7 +17284,7 @@ ${e}`);
17220
17284
  }
17221
17285
  const toDo = this.queue.pop();
17222
17286
  const id = toDo.id;
17223
- this.resolveHash[UUID] = toDo.resolve;
17287
+ this.resolveHash[UUID] = { resolve: toDo.resolve, reject: toDo.reject };
17224
17288
  worker.postMessage({
17225
17289
  data: toDo.arguments,
17226
17290
  uuid: UUID++,
@@ -17250,6 +17314,9 @@ ${e}`);
17250
17314
  const validImages$1 = [".jpg", ".png", ".jpeg", ".avif", ".webp"];
17251
17315
  async function loadImageBitmap(url) {
17252
17316
  const response = await settings.ADAPTER.fetch(url);
17317
+ if (!response.ok) {
17318
+ throw new Error(`[loadImageBitmap] Failed to fetch ${url}: ${response.status} ${response.statusText}`);
17319
+ }
17253
17320
  const imageBlob = await response.blob();
17254
17321
  const imageBitmap = await createImageBitmap(imageBlob);
17255
17322
  return imageBitmap;
@@ -17265,7 +17332,7 @@ ${e}`);
17265
17332
  test(url) {
17266
17333
  let isValidBase64Suffix = false;
17267
17334
  for (let i = 0; i < validImages$1.length; i++) {
17268
- if (url.indexOf(`data:image/${validImages$1[i].slice(1)}`) === 0) {
17335
+ if (url.startsWith(`data:image/${validImages$1[i].slice(1)}`)) {
17269
17336
  isValidBase64Suffix = true;
17270
17337
  break;
17271
17338
  }
@@ -17275,7 +17342,11 @@ ${e}`);
17275
17342
  async load(url, asset, loader) {
17276
17343
  let src = null;
17277
17344
  if (globalThis.createImageBitmap) {
17278
- src = this.config.preferWorkers ? await WorkerManager.loadImageBitmap(url) : await loadImageBitmap(url);
17345
+ if (this.config.preferWorkers && await WorkerManager.isImageBitmapSupported()) {
17346
+ src = await WorkerManager.loadImageBitmap(url);
17347
+ } else {
17348
+ src = await loadImageBitmap(url);
17349
+ }
17279
17350
  } else {
17280
17351
  src = await new Promise((resolve) => {
17281
17352
  src = new Image();
@@ -17392,8 +17463,8 @@ ${e}`);
17392
17463
  extensions$1.add(detectDefaults);
17393
17464
 
17394
17465
  /*!
17395
- * @pixi/compressed-textures - v7.0.0-beta.3
17396
- * Compiled Thu, 13 Oct 2022 15:35:43 UTC
17466
+ * @pixi/compressed-textures - v7.0.0-beta.4
17467
+ * Compiled Thu, 20 Oct 2022 19:45:44 UTC
17397
17468
  *
17398
17469
  * @pixi/compressed-textures is licensed under the MIT License.
17399
17470
  * http://www.opensource.org/licenses/mit-license
@@ -18081,8 +18152,8 @@ ${e}`);
18081
18152
  extensions$1.add(resolveCompressedTextureUrl);
18082
18153
 
18083
18154
  /*!
18084
- * @pixi/extract - v7.0.0-beta.3
18085
- * Compiled Thu, 13 Oct 2022 15:35:43 UTC
18155
+ * @pixi/extract - v7.0.0-beta.4
18156
+ * Compiled Thu, 20 Oct 2022 19:45:44 UTC
18086
18157
  *
18087
18158
  * @pixi/extract is licensed under the MIT License.
18088
18159
  * http://www.opensource.org/licenses/mit-license
@@ -18227,8 +18298,8 @@ ${e}`);
18227
18298
  extensions$1.add(Extract);
18228
18299
 
18229
18300
  /*!
18230
- * @pixi/graphics - v7.0.0-beta.3
18231
- * Compiled Thu, 13 Oct 2022 15:35:43 UTC
18301
+ * @pixi/graphics - v7.0.0-beta.4
18302
+ * Compiled Thu, 20 Oct 2022 19:45:44 UTC
18232
18303
  *
18233
18304
  * @pixi/graphics is licensed under the MIT License.
18234
18305
  * http://www.opensource.org/licenses/mit-license
@@ -18506,11 +18577,17 @@ ${e}`);
18506
18577
  const height = rectData.height;
18507
18578
  const points = graphicsData.points;
18508
18579
  points.length = 0;
18580
+ if (!(width >= 0 && height >= 0)) {
18581
+ return;
18582
+ }
18509
18583
  points.push(x, y, x + width, y, x + width, y + height, x, y + height);
18510
18584
  },
18511
18585
  triangulate(graphicsData, graphicsGeometry) {
18512
18586
  const points = graphicsData.points;
18513
18587
  const verts = graphicsGeometry.points;
18588
+ if (points.length === 0) {
18589
+ return;
18590
+ }
18514
18591
  const vertPos = verts.length / 2;
18515
18592
  verts.push(points[0], points[1], points[2], points[3], points[6], points[7], points[4], points[5]);
18516
18593
  graphicsGeometry.indices.push(vertPos, vertPos + 1, vertPos + 2, vertPos + 1, vertPos + 2, vertPos + 3);
@@ -19992,8 +20069,8 @@ ${e}`);
19992
20069
  };
19993
20070
 
19994
20071
  /*!
19995
- * @pixi/mesh - v7.0.0-beta.3
19996
- * Compiled Thu, 13 Oct 2022 15:35:43 UTC
20072
+ * @pixi/mesh - v7.0.0-beta.4
20073
+ * Compiled Thu, 20 Oct 2022 19:45:44 UTC
19997
20074
  *
19998
20075
  * @pixi/mesh is licensed under the MIT License.
19999
20076
  * http://www.opensource.org/licenses/mit-license
@@ -20317,8 +20394,8 @@ ${e}`);
20317
20394
  }
20318
20395
 
20319
20396
  /*!
20320
- * @pixi/mesh-extras - v7.0.0-beta.3
20321
- * Compiled Thu, 13 Oct 2022 15:35:43 UTC
20397
+ * @pixi/mesh-extras - v7.0.0-beta.4
20398
+ * Compiled Thu, 20 Oct 2022 19:45:44 UTC
20322
20399
  *
20323
20400
  * @pixi/mesh-extras is licensed under the MIT License.
20324
20401
  * http://www.opensource.org/licenses/mit-license
@@ -20675,8 +20752,8 @@ ${e}`);
20675
20752
  }
20676
20753
 
20677
20754
  /*!
20678
- * @pixi/particle-container - v7.0.0-beta.3
20679
- * Compiled Thu, 13 Oct 2022 15:35:43 UTC
20755
+ * @pixi/particle-container - v7.0.0-beta.4
20756
+ * Compiled Thu, 20 Oct 2022 19:45:44 UTC
20680
20757
  *
20681
20758
  * @pixi/particle-container is licensed under the MIT License.
20682
20759
  * http://www.opensource.org/licenses/mit-license
@@ -21080,8 +21157,8 @@ ${e}`);
21080
21157
  extensions$1.add(ParticleRenderer);
21081
21158
 
21082
21159
  /*!
21083
- * @pixi/text - v7.0.0-beta.3
21084
- * Compiled Thu, 13 Oct 2022 15:35:43 UTC
21160
+ * @pixi/text - v7.0.0-beta.4
21161
+ * Compiled Thu, 20 Oct 2022 19:45:44 UTC
21085
21162
  *
21086
21163
  * @pixi/text is licensed under the MIT License.
21087
21164
  * http://www.opensource.org/licenses/mit-license
@@ -21470,6 +21547,9 @@ ${e}`);
21470
21547
  }
21471
21548
  }
21472
21549
 
21550
+ const contextSettings = {
21551
+ willReadFrequently: true
21552
+ };
21473
21553
  class TextMetrics {
21474
21554
  constructor(text, style, width, height, lines, lineWidths, lineHeight, maxLineWidth, fontProperties) {
21475
21555
  this.text = text;
@@ -21490,7 +21570,7 @@ ${e}`);
21490
21570
  fontProperties.fontSize = style.fontSize;
21491
21571
  fontProperties.ascent = style.fontSize;
21492
21572
  }
21493
- const context = canvas.getContext("2d");
21573
+ const context = canvas.getContext("2d", contextSettings);
21494
21574
  context.font = font;
21495
21575
  const outputText = wordWrap ? TextMetrics.wordWrap(text, style, canvas) : text;
21496
21576
  const lines = outputText.split(/(?:\r\n|\r|\n)/);
@@ -21513,7 +21593,7 @@ ${e}`);
21513
21593
  return new TextMetrics(text, style, width, height, lines, lineWidths, lineHeight + style.leading, maxLineWidth, fontProperties);
21514
21594
  }
21515
21595
  static wordWrap(text, style, canvas = TextMetrics._canvas) {
21516
- const context = canvas.getContext("2d");
21596
+ const context = canvas.getContext("2d", contextSettings);
21517
21597
  let width = 0;
21518
21598
  let line = "";
21519
21599
  let lines = "";
@@ -21760,7 +21840,7 @@ ${e}`);
21760
21840
  let canvas;
21761
21841
  try {
21762
21842
  const c = new OffscreenCanvas(0, 0);
21763
- const context = c.getContext("2d");
21843
+ const context = c.getContext("2d", contextSettings);
21764
21844
  if (context?.measureText) {
21765
21845
  TextMetrics.__canvas = c;
21766
21846
  return c;
@@ -21776,7 +21856,7 @@ ${e}`);
21776
21856
  }
21777
21857
  static get _context() {
21778
21858
  if (!TextMetrics.__context) {
21779
- TextMetrics.__context = TextMetrics._canvas.getContext("2d");
21859
+ TextMetrics.__context = TextMetrics._canvas.getContext("2d", contextSettings);
21780
21860
  }
21781
21861
  return TextMetrics.__context;
21782
21862
  }
@@ -21827,7 +21907,9 @@ ${e}`);
21827
21907
  super(texture);
21828
21908
  this._ownCanvas = ownCanvas;
21829
21909
  this.canvas = canvas;
21830
- this.context = canvas.getContext("2d");
21910
+ this.context = canvas.getContext("2d", {
21911
+ willReadFrequently: true
21912
+ });
21831
21913
  this._resolution = settings.RESOLUTION;
21832
21914
  this._autoResolution = true;
21833
21915
  this._text = null;
@@ -22145,8 +22227,8 @@ ${e}`);
22145
22227
  Text.experimentalLetterSpacing = false;
22146
22228
 
22147
22229
  /*!
22148
- * @pixi/prepare - v7.0.0-beta.3
22149
- * Compiled Thu, 13 Oct 2022 15:35:43 UTC
22230
+ * @pixi/prepare - v7.0.0-beta.4
22231
+ * Compiled Thu, 20 Oct 2022 19:45:44 UTC
22150
22232
  *
22151
22233
  * @pixi/prepare is licensed under the MIT License.
22152
22234
  * http://www.opensource.org/licenses/mit-license
@@ -22418,8 +22500,8 @@ ${e}`);
22418
22500
  }
22419
22501
 
22420
22502
  /*!
22421
- * @pixi/spritesheet - v7.0.0-beta.3
22422
- * Compiled Thu, 13 Oct 2022 15:35:43 UTC
22503
+ * @pixi/spritesheet - v7.0.0-beta.4
22504
+ * Compiled Thu, 20 Oct 2022 19:45:44 UTC
22423
22505
  *
22424
22506
  * @pixi/spritesheet is licensed under the MIT License.
22425
22507
  * http://www.opensource.org/licenses/mit-license
@@ -22631,8 +22713,8 @@ ${e}`);
22631
22713
  extensions$1.add(spritesheetAsset);
22632
22714
 
22633
22715
  /*!
22634
- * @pixi/sprite-animated - v7.0.0-beta.3
22635
- * Compiled Thu, 13 Oct 2022 15:35:43 UTC
22716
+ * @pixi/sprite-animated - v7.0.0-beta.4
22717
+ * Compiled Thu, 20 Oct 2022 19:45:44 UTC
22636
22718
  *
22637
22719
  * @pixi/sprite-animated is licensed under the MIT License.
22638
22720
  * http://www.opensource.org/licenses/mit-license
@@ -22827,8 +22909,8 @@ ${e}`);
22827
22909
  }
22828
22910
 
22829
22911
  /*!
22830
- * @pixi/sprite-tiling - v7.0.0-beta.3
22831
- * Compiled Thu, 13 Oct 2022 15:35:43 UTC
22912
+ * @pixi/sprite-tiling - v7.0.0-beta.4
22913
+ * Compiled Thu, 20 Oct 2022 19:45:44 UTC
22832
22914
  *
22833
22915
  * @pixi/sprite-tiling is licensed under the MIT License.
22834
22916
  * http://www.opensource.org/licenses/mit-license
@@ -23026,8 +23108,8 @@ ${e}`);
23026
23108
  extensions$1.add(TilingSpriteRenderer);
23027
23109
 
23028
23110
  /*!
23029
- * @pixi/text-bitmap - v7.0.0-beta.3
23030
- * Compiled Thu, 13 Oct 2022 15:35:43 UTC
23111
+ * @pixi/text-bitmap - v7.0.0-beta.4
23112
+ * Compiled Thu, 20 Oct 2022 19:45:44 UTC
23031
23113
  *
23032
23114
  * @pixi/text-bitmap is licensed under the MIT License.
23033
23115
  * http://www.opensource.org/licenses/mit-license
@@ -23473,13 +23555,14 @@ ${e}`);
23473
23555
  file: ""
23474
23556
  });
23475
23557
  }
23476
- const metrics = TextMetrics.measureText(charsList[i], style, false, canvas);
23558
+ const character = charsList[i];
23559
+ const metrics = TextMetrics.measureText(character, style, false, canvas);
23477
23560
  const width = metrics.width;
23478
23561
  const height = Math.ceil(metrics.height);
23479
23562
  const textureGlyphWidth = Math.ceil((style.fontStyle === "italic" ? 2 : 1) * width);
23480
23563
  if (positionY >= textureHeight - height * resolution) {
23481
23564
  if (positionY === 0) {
23482
- throw new Error(`[BitmapFont] textureHeight ${textureHeight}px is too small for ${style.fontSize}px fonts`);
23565
+ throw new Error(`[BitmapFont] textureHeight ${textureHeight}px is too small (fontFamily: '${style.fontFamily}', fontSize: ${style.fontSize}px, char: '${character}')`);
23483
23566
  }
23484
23567
  --i;
23485
23568
  canvas = null;
@@ -23492,6 +23575,9 @@ ${e}`);
23492
23575
  }
23493
23576
  maxCharHeight = Math.max(height + metrics.fontProperties.descent, maxCharHeight);
23494
23577
  if (textureGlyphWidth * resolution + positionX >= lineWidth) {
23578
+ if (positionX === 0) {
23579
+ throw new Error(`[BitmapFont] textureWidth ${textureWidth}px is too small (fontFamily: '${style.fontFamily}', fontSize: ${style.fontSize}px, char: '${character}')`);
23580
+ }
23495
23581
  --i;
23496
23582
  positionY += maxCharHeight * resolution;
23497
23583
  positionY = Math.ceil(positionY);
@@ -23987,6 +24073,9 @@ ${e}`);
23987
24073
  const data = BitmapFont.available[this._fontName];
23988
24074
  const pageMeshDataPool = data.distanceFieldType === "none" ? pageMeshDataDefaultPageMeshData : pageMeshDataMSDFPageMeshData;
23989
24075
  pageMeshDataPool.push(...this._activePagesMeshData);
24076
+ for (const data2 of this._activePagesMeshData) {
24077
+ this.removeChild(data2.mesh);
24078
+ }
23990
24079
  this._activePagesMeshData = [];
23991
24080
  pageMeshDataPool.filter((page) => _textureCache[page.mesh.texture.baseTexture.uid]).forEach((page) => {
23992
24081
  page.mesh.texture = Texture.EMPTY;