@vived/app 2.18.0 → 2.19.0

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.
@@ -29,11 +29,16 @@ class BabylonImp {
29
29
  return;
30
30
  if (!this._renderCanvas)
31
31
  return;
32
+ if (this.workingCanvas.height === this._renderCanvas.height &&
33
+ this.workingCanvas.width === this._renderCanvas.width) {
34
+ return;
35
+ }
32
36
  if (this.resizeEngine) {
33
37
  this.resizeEngine();
34
38
  }
35
39
  this.workingCanvas.height = this._renderCanvas.height;
36
40
  this.workingCanvas.width = this._renderCanvas.width;
41
+ this.observers.notify();
37
42
  };
38
43
  this.submitRenderCanvas = (canvas) => {
39
44
  if (canvas === this._renderCanvas)
@@ -1,4 +1,5 @@
1
1
  import { Result } from "../ValueObjects";
2
+ export declare type OnStateHasBeenApplied = () => void;
2
3
  export interface SerializedStates {
3
4
  version: number;
4
5
  systems: SystemState[];
@@ -22,5 +23,7 @@ export interface StateMachine {
22
23
  applySerializedStatesString: (state: string, duration?: number) => void;
23
24
  setDefaultState(transitionTime: number): void;
24
25
  registerSerializedSystem(serializedSystem: SerializedSystem): Result<null, Error>;
26
+ addStateHasBeenAppliedObserver: (observer: OnStateHasBeenApplied) => void;
27
+ removeStateHasBeenAppliedObserver: (observer: OnStateHasBeenApplied) => void;
25
28
  }
26
29
  export declare function makeStateMachine(): StateMachine;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.makeStateMachine = void 0;
4
4
  const ValueObjects_1 = require("../ValueObjects");
5
+ const ObserverList_1 = require("./ObserverList");
5
6
  function makeStateMachine() {
6
7
  return new StateMachineImp();
7
8
  }
@@ -10,6 +11,7 @@ class StateMachineImp {
10
11
  constructor() {
11
12
  this.serializedSystems = new Map();
12
13
  this.serilizationVersion = 2;
14
+ this.stateAppliedObservers = new ObserverList_1.ObserverList();
13
15
  this.transitionEaseFunction = (normalizedTime) => {
14
16
  return normalizedTime; // default to a linear function
15
17
  };
@@ -70,6 +72,7 @@ class StateMachineImp {
70
72
  system.applyDefaultState(duration);
71
73
  }
72
74
  });
75
+ this.stateAppliedObservers.notify();
73
76
  return ValueObjects_1.resolve(null);
74
77
  }
75
78
  // Here is where we will add support for future versions
@@ -83,6 +86,13 @@ class StateMachineImp {
83
86
  this.serializedSystems.forEach((system) => {
84
87
  system.applyDefaultState(duration);
85
88
  });
89
+ this.stateAppliedObservers.notify();
90
+ };
91
+ this.addStateHasBeenAppliedObserver = (observer) => {
92
+ this.stateAppliedObservers.add(observer);
93
+ };
94
+ this.removeStateHasBeenAppliedObserver = (observer) => {
95
+ this.stateAppliedObservers.remove(observer);
86
96
  };
87
97
  }
88
98
  }
@@ -35,7 +35,8 @@ class TouchInputImp {
35
35
  this._eventElement = eventElement;
36
36
  };
37
37
  this.onTouchStart = (e) => {
38
- e.preventDefault();
38
+ if (e.cancelable)
39
+ e.preventDefault();
39
40
  const touchInput = this.createTouchInputEvent(e);
40
41
  this.controllers.forEach((c) => {
41
42
  if (c.onTouchStart) {
@@ -44,7 +45,8 @@ class TouchInputImp {
44
45
  });
45
46
  };
46
47
  this.onTouchMove = (e) => {
47
- e.preventDefault();
48
+ if (e.cancelable)
49
+ e.preventDefault();
48
50
  const touchInput = this.createTouchInputEvent(e);
49
51
  this.controllers.forEach((c) => {
50
52
  if (c.onTouchMove) {
@@ -53,7 +55,8 @@ class TouchInputImp {
53
55
  });
54
56
  };
55
57
  this.onTouchEnd = (e) => {
56
- e.preventDefault();
58
+ if (e.cancelable)
59
+ e.preventDefault();
57
60
  const touchInput = this.createTouchInputEvent(e);
58
61
  this.controllers.forEach((c) => {
59
62
  if (c.onTouchEnd) {
@@ -62,7 +65,8 @@ class TouchInputImp {
62
65
  });
63
66
  };
64
67
  this.onTouchCancel = (e) => {
65
- e.preventDefault();
68
+ if (e.cancelable)
69
+ e.preventDefault();
66
70
  const touchInput = this.createTouchInputEvent(e);
67
71
  this.controllers.forEach((c) => {
68
72
  if (c.onTouchCancel) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vived/app",
3
- "version": "2.18.0",
3
+ "version": "2.19.0",
4
4
  "description": "Public package for the VIVED Learning App system",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",