@vived/app 2.15.3 → 2.15.6

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.
@@ -11,20 +11,25 @@ class DevicePreviewImp {
11
11
  constructor() {
12
12
  this.observers = new _1.ObserverList();
13
13
  this._usePreview = false;
14
- this._previewSize = ValueObjects_1.Vector2.zero();
14
+ this._previewSize = ValueObjects_1.Vector2.Zero();
15
15
  this.setDevicePreview = (x, y) => {
16
- if (this._usePreview &&
17
- this._previewSize.x === x &&
16
+ if (this._previewSize.x === x &&
18
17
  this._previewSize.y === y)
19
18
  return;
20
19
  this._usePreview = true;
21
20
  this._previewSize = new ValueObjects_1.Vector2(x, y);
21
+ if (x > 0 && y > 0) {
22
+ this._usePreview = true;
23
+ }
24
+ else {
25
+ this._usePreview = false;
26
+ }
22
27
  this.observers.notify();
23
28
  };
24
29
  this.clearDevicePreview = () => {
25
30
  if (!this._usePreview)
26
31
  return;
27
- this._previewSize = ValueObjects_1.Vector2.zero();
32
+ this._previewSize = ValueObjects_1.Vector2.Zero();
28
33
  this._usePreview = false;
29
34
  this.observers.notify();
30
35
  };
@@ -18,7 +18,7 @@ class TouchInputImp {
18
18
  this.getTouchOffsetPosition = (touch) => {
19
19
  if (!this.eventElementBounds) {
20
20
  console.warn("No target bounds");
21
- return ValueObjects_1.Vector2.zero();
21
+ return ValueObjects_1.Vector2.Zero();
22
22
  }
23
23
  const x = touch.clientX - this.eventElementBounds.x;
24
24
  const y = touch.clientY - this.eventElementBounds.y;
@@ -11,3 +11,4 @@ export declare class DevicePreviewPM {
11
11
  dispose(): void;
12
12
  constructor(devicePreview: DevicePreview, updateView: (vm: DevicePreviewVM) => void);
13
13
  }
14
+ export declare const defaultDevicePreviewVM: DevicePreviewVM;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DevicePreviewPM = void 0;
3
+ exports.defaultDevicePreviewVM = exports.DevicePreviewPM = void 0;
4
4
  class DevicePreviewPM {
5
5
  constructor(devicePreview, updateView) {
6
6
  this.doUpdateView = () => {
@@ -23,3 +23,8 @@ class DevicePreviewPM {
23
23
  }
24
24
  }
25
25
  exports.DevicePreviewPM = DevicePreviewPM;
26
+ exports.defaultDevicePreviewVM = {
27
+ x: 0,
28
+ y: 0,
29
+ useDevicePreview: false,
30
+ };
@@ -5,10 +5,12 @@ class ShowBabylonInspectorPM {
5
5
  constructor(babylon, updateView) {
6
6
  this.doUpdateView = () => {
7
7
  const showInspector = this.babylon.showInspector;
8
- if (showInspector === this.lastSetState)
8
+ const hasCanvas = this.babylon.renderCanvas === undefined ? false : true;
9
+ const showBeShown = hasCanvas && showInspector;
10
+ if (showBeShown === this.lastSetState)
9
11
  return;
10
- this.updateView(showInspector);
11
- this.lastSetState = showInspector;
12
+ this.updateView(showBeShown);
13
+ this.lastSetState = showBeShown;
12
14
  };
13
15
  this.babylon = babylon;
14
16
  this.updateView = updateView;
@@ -6,7 +6,7 @@ class PixelDollyFocusCamera {
6
6
  constructor(focusCamera) {
7
7
  this.focusCamera = focusCamera;
8
8
  this.sensitivity = 0.05;
9
- this.previousPixelPosition = ValueObjects_1.Vector2.zero();
9
+ this.previousPixelPosition = ValueObjects_1.Vector2.Zero();
10
10
  this.doDolly = (pixelPosition) => {
11
11
  const pixelDeltaY = pixelPosition.y - this.previousPixelPosition.y;
12
12
  const deltaRadius = pixelDeltaY * this.sensitivity;
@@ -1,6 +1,6 @@
1
1
  import { Angle } from ".";
2
2
  export declare class Vector2 {
3
- static zero(): Vector2;
3
+ static Zero(): Vector2;
4
4
  static One(): Vector2;
5
5
  static Equal(a: Vector2, b: Vector2): boolean;
6
6
  static Add(a: Vector2, b: Vector2): Vector2;
@@ -7,7 +7,7 @@ class Vector2 {
7
7
  this.x = x;
8
8
  this.y = y;
9
9
  }
10
- static zero() {
10
+ static Zero() {
11
11
  return new Vector2(0, 0);
12
12
  }
13
13
  static One() {
@@ -35,7 +35,7 @@ class Vector2 {
35
35
  get unit() {
36
36
  const mag = this.magnitued;
37
37
  if (mag === 0) {
38
- return Vector2.zero();
38
+ return Vector2.Zero();
39
39
  }
40
40
  const unitX = this.x / mag;
41
41
  const unitY = this.y / mag;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vived/app",
3
- "version": "2.15.3",
3
+ "version": "2.15.6",
4
4
  "description": "Public package for the VIVED Learning App system",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",