@woosh/meep-engine 2.119.2 → 2.119.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/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "description": "Fully featured ECS game engine written in JavaScript",
6
6
  "type": "module",
7
7
  "author": "Alexander Goldring",
8
- "version": "2.119.2",
8
+ "version": "2.119.3",
9
9
  "main": "build/meep.module.js",
10
10
  "module": "build/meep.module.js",
11
11
  "exports": {
@@ -5,5 +5,4 @@
5
5
  * @returns {number}
6
6
  */
7
7
  export function resolveBoxOverlapUsingForce(forces: Vector2[], boxes: Array<AABB2>): number;
8
- import Vector2 from "../../../geom/Vector2.js";
9
8
  //# sourceMappingURL=resolveBoxOverlapUsingForce.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"resolveBoxOverlapUsingForce.d.ts","sourceRoot":"","sources":["../../../../../../src/core/graph/layout/box/resolveBoxOverlapUsingForce.js"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,oDAJW,OAAO,EAAE,SACT,YAAa,GACX,MAAM,CA6FlB;oBAnGmB,0BAA0B"}
1
+ {"version":3,"file":"resolveBoxOverlapUsingForce.d.ts","sourceRoot":"","sources":["../../../../../../src/core/graph/layout/box/resolveBoxOverlapUsingForce.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,oDAJW,SAAS,SACT,YAAa,GACX,MAAM,CAyFlB"}
@@ -1,5 +1,3 @@
1
- import Vector2 from "../../../geom/Vector2.js";
2
-
3
1
  /**
4
2
  *
5
3
  * @param {Vector2[]} forces
@@ -63,10 +61,6 @@ export function resolveBoxOverlapUsingForce(forces, boxes) {
63
61
  dX = 0;
64
62
  }
65
63
 
66
- //create separation vector
67
- const d = new Vector2(dX, dY);
68
- const halfD = d.multiplyScalar(0.5);
69
-
70
64
  const f1 = forces[i];
71
65
  const f2 = forces[j];
72
66
 
@@ -74,12 +68,12 @@ export function resolveBoxOverlapUsingForce(forces, boxes) {
74
68
  if (b0.locked === true && b1.locked === true) {
75
69
  continue;
76
70
  } else if (b0.locked === true) {
77
- f2.sub(d);
71
+ f2._sub(dX, dY);
78
72
  } else if (b1.locked === true) {
79
- f1.add(d);
73
+ f1._add(dX, dY);
80
74
  } else {
81
- f1.add(halfD);
82
- f2.sub(halfD);
75
+ f1._add(dX*0.5, dY*0.5);
76
+ f2._sub(dX*0.5, dY*0.5);
83
77
  }
84
78
 
85
79
  moves++;
@@ -301,6 +301,22 @@ class Engine {
301
301
  this.plugins.initialize(this);
302
302
  }
303
303
 
304
+ #initialize_audio() {
305
+ const sound = this.sound;
306
+ if (sound === undefined || sound === null) {
307
+ // no sound engine
308
+ return;
309
+ }
310
+
311
+ // hook up context resumption to input
312
+ if (this.devices.pointer !== undefined) {
313
+
314
+ this.devices.pointer.on.down.addOne(sound.resumeContext, sound);
315
+ this.devices.keyboard.on.down.addOne(sound.resumeContext, sound);
316
+
317
+ }
318
+ }
319
+
304
320
 
305
321
  get inputEngine() {
306
322
  throw new Error('Deprecated, use .devices instead');
@@ -449,6 +465,8 @@ class Engine {
449
465
  start() {
450
466
  this.assetManager.startup();
451
467
 
468
+ this.#initialize_audio();
469
+
452
470
  const promiseEntityManager = () => {
453
471
  return new Promise((resolve, reject) => {
454
472
  //initialize entity manager