@woosh/meep-engine 2.110.6 → 2.110.8

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/build/meep.cjs CHANGED
@@ -63809,7 +63809,7 @@ class WorkerBuilder {
63809
63809
  result.push(obj);
63810
63810
  } else if (obj.buffer instanceof ArrayBuffer) {
63811
63811
  result.push(obj.buffer);
63812
- } else if (obj instanceof ImageBitmap) {
63812
+ } else if (typeof ImageBitmap !== "undefined" && obj instanceof ImageBitmap) {
63813
63813
  result.push(obj);
63814
63814
  } else {
63815
63815
  for (var i in obj) {
@@ -76227,6 +76227,19 @@ function murmur3_32(key, seed) {
76227
76227
  return h1 >>> 0;
76228
76228
  }
76229
76229
 
76230
+ /**
76231
+ * Guards against cases where ImageBitmap doesn't exist
76232
+ * @param {*} image
76233
+ * @return {boolean}
76234
+ */
76235
+ function isImageBitmap(image) {
76236
+ /**
76237
+ * check that browser/environment has the class at all to avoid potential exceptions
76238
+ * Required for Safari below version 15.6
76239
+ */
76240
+ return typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap;
76241
+ }
76242
+
76230
76243
  /**
76231
76244
  * Transfer bitmap contents to Sampler2D, effectively moving data to CPU, making it readable
76232
76245
  * @param {WebGL2RenderingContext} gl
@@ -76449,15 +76462,14 @@ function computeImageDataHash(image) {
76449
76462
 
76450
76463
  let result = 0;
76451
76464
 
76452
- if (
76453
- // check that browser/environment has the class at all to avoid potential exceptions
76454
- // Required for Safari below version 15.6
76455
- ImageBitmap !== undefined
76456
- && (image instanceof ImageBitmap)
76457
- ) {
76465
+ if (isImageBitmap(image)) {
76466
+
76458
76467
  result = computeImageBitmapHash(image);
76468
+
76459
76469
  } else if (image instanceof HTMLImageElement) {
76470
+
76460
76471
  result = computeStringHash(image.src);
76472
+
76461
76473
  }
76462
76474
 
76463
76475
  let width = 0;
@@ -76654,13 +76666,10 @@ function textureImagesEqual(a, b) {
76654
76666
  return false;
76655
76667
  }
76656
76668
 
76657
- if (
76658
- // check that browser/environment has the class at all to avoid potential exceptions
76659
- // Required for Safari below version 15.6
76660
- ImageBitmap !== undefined
76661
- && (a instanceof ImageBitmap && b instanceof ImageBitmap)
76662
- ) {
76669
+ if (isImageBitmap(a) && isImageBitmap(b)) {
76670
+
76663
76671
  return computeImageBitmapEquality(a, b);
76672
+
76664
76673
  }
76665
76674
 
76666
76675
  if (Array.isArray(a) && Array.isArray(b)) {
@@ -80700,8 +80709,10 @@ class AABB2 {
80700
80709
  *
80701
80710
  * @param {Vector2} result
80702
80711
  */
80703
- getCenter(result) {
80712
+ getCenter(result = new Vector2()) {
80704
80713
  result.set(this.centerX, this.centerY);
80714
+
80715
+ return result;
80705
80716
  }
80706
80717
 
80707
80718
  /**