@woosh/meep-engine 2.33.29 → 2.33.33

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,4 +1,8 @@
1
+ import Signal from "../events/signal/Signal";
2
+
1
3
  export default class ObservedBoolean {
4
+ readonly onChanged: Signal<boolean, boolean>
5
+
2
6
  constructor(value: boolean)
3
7
 
4
8
  set(value: boolean): ObservedBoolean
@@ -80,7 +80,7 @@ export class ReactiveBinaryExpression extends ReactiveExpression {
80
80
  return;
81
81
  }
82
82
 
83
- this.onChanged.dispatch(result);
83
+ this.onChanged.send1(result);
84
84
 
85
85
  this.__oldValue = result;
86
86
  }
@@ -0,0 +1,10 @@
1
+ import Signal from "../../../events/signal/Signal";
2
+ import {DataType} from "../../../parser/simple/DataType";
3
+
4
+ export class ReactiveExpression<T> {
5
+ readonly onChanged: Signal<T>
6
+
7
+ readonly dataType: DataType
8
+
9
+ getValue(): T
10
+ }
@@ -0,0 +1,5 @@
1
+ import {ReactiveExpression} from "../ReactiveExpression";
2
+
3
+ export class ReactiveAnd extends ReactiveExpression<boolean> {
4
+ static from(left: ReactiveExpression<boolean>, right: ReactiveExpression<boolean>): ReactiveAnd
5
+ }
@@ -0,0 +1,11 @@
1
+ import {ReactiveExpression} from "../ReactiveExpression";
2
+ import ObservedBoolean from "../../../ObservedBoolean";
3
+ import Vector1 from "../../../../geom/Vector1";
4
+
5
+ export class ReactiveReference<T> extends ReactiveExpression<T> {
6
+ constructor(name: string)
7
+
8
+ static from<T>(source: ReactiveExpression<T>, name?: string): ReactiveReference<T>
9
+ static from(source: ObservedBoolean, name?: string): ReactiveReference<boolean>
10
+ static from(source: Vector1, name?: string): ReactiveReference<number>
11
+ }
@@ -0,0 +1,5 @@
1
+ export enum DataType{
2
+ String,
3
+ Number,
4
+ Boolean
5
+ }
@@ -1 +1 @@
1
- export const KeyCodes: Object;
1
+ export const KeyCodes: { [name: string]: number };
@@ -60,14 +60,30 @@ function forEachTouch(touchList, callback) {
60
60
  */
61
61
  function getTouchCenter(touchList, result) {
62
62
  const length = touchList.length;
63
+
63
64
  let x = 0, y = 0;
64
- for (let i = 0; i < length; i++) {
65
- const touch = touchList.item(i);
66
- x += touch.clientX;
67
- y += touch.clientY;
65
+
66
+ if (length > 0) {
67
+
68
+ for (let i = 0; i < length; i++) {
69
+ const touch = touchList.item(i);
70
+
71
+ if (touch === null) {
72
+ continue;
73
+ }
74
+
75
+ x += touch.clientX;
76
+ y += touch.clientY;
77
+ }
78
+
79
+ // average to get center
80
+ x /= length;
81
+ y /= length;
82
+
68
83
  }
69
- //
70
- result.set(x / length, y / length);
84
+
85
+ result.set(x, y);
86
+
71
87
  }
72
88
 
73
89
  /**
@@ -435,13 +451,13 @@ function PointerDevice(domElement) {
435
451
  observeTap(this.on.up, this.on.down, this.on.move, 10, this.on.tap);
436
452
  observeDrag(globalUp, this.on.down, this.on.move, this.on.dragStart, this.on.dragEnd, this.on.drag);
437
453
  observePinch({
438
- touchStart: touchStart,
439
- touchEnd: touchEnd,
440
- touchMove: touchMove,
441
- pinch: this.on.pinch,
442
- pinchStart: this.on.pinchStart,
443
- pinchEnd: this.on.pinchEnd
444
- });
454
+ touchStart: touchStart,
455
+ touchEnd: touchEnd,
456
+ touchMove: touchMove,
457
+ pinch: this.on.pinch,
458
+ pinchStart: this.on.pinchStart,
459
+ pinchEnd: this.on.pinchEnd
460
+ });
445
461
  }
446
462
 
447
463
  /**
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "productName": "Meep",
5
5
  "description": "production-ready JavaScript game engine based on Entity Component System Architecture",
6
6
  "author": "Alexander Goldring",
7
- "version": "2.33.29",
7
+ "version": "2.33.33",
8
8
  "dependencies": {
9
9
  "fast-levenshtein": "2.0.6",
10
10
  "opentype.js": "1.3.3",