@vived/app 2.11.2 → 2.12.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.
Files changed (52) hide show
  1. package/lib/Entities/Babylon.d.ts +1 -2
  2. package/lib/Entities/Babylon.js +6 -7
  3. package/lib/Entities/DevicePreview.d.ts +1 -1
  4. package/lib/Entities/DevicePreview.js +5 -5
  5. package/lib/Entities/FocusCamera.d.ts +1 -1
  6. package/lib/Entities/FocusCamera.js +19 -19
  7. package/lib/Entities/MemoizedVector2.d.ts +3 -7
  8. package/lib/Entities/MemoizedVector2.js +7 -24
  9. package/lib/Entities/MemoizedVector3.d.ts +3 -9
  10. package/lib/Entities/MemoizedVector3.js +7 -33
  11. package/lib/Entities/MouseInput.js +3 -3
  12. package/lib/Entities/ParametricLine.d.ts +1 -1
  13. package/lib/Entities/ParametricLine.js +8 -8
  14. package/lib/Entities/ParametricPlane.d.ts +3 -3
  15. package/lib/Entities/ParametricPlane.js +10 -10
  16. package/lib/Entities/TouchInput.d.ts +1 -1
  17. package/lib/Entities/TouchInput.js +6 -6
  18. package/lib/Entities/index.d.ts +0 -6
  19. package/lib/Entities/index.js +0 -6
  20. package/lib/PresentationManagers/FocusCameraPM.d.ts +2 -1
  21. package/lib/PresentationManagers/FocusCameraPM.js +4 -4
  22. package/lib/UseCases/FocusCamera/BumpDollyFocusCamera.d.ts +2 -1
  23. package/lib/UseCases/FocusCamera/BumpDollyFocusCamera.js +4 -3
  24. package/lib/UseCases/FocusCamera/LerpFocusCamera.js +2 -2
  25. package/lib/UseCases/FocusCamera/PinchDollyFocusCamera.d.ts +2 -1
  26. package/lib/UseCases/FocusCamera/PinchDollyFocusCamera.js +4 -3
  27. package/lib/UseCases/FocusCamera/PixelDollyFocusCamera.d.ts +2 -1
  28. package/lib/UseCases/FocusCamera/PixelDollyFocusCamera.js +5 -5
  29. package/lib/UseCases/FocusCamera/PixelOrbitFocusCamera.d.ts +2 -1
  30. package/lib/UseCases/FocusCamera/PixelOrbitFocusCamera.js +2 -1
  31. package/lib/UseCases/FocusCamera/PixelPlanePanFocusCamera.d.ts +2 -1
  32. package/lib/UseCases/FocusCamera/PixelPlanePanFocusCamera.js +4 -4
  33. package/lib/UseCases/FocusCamera/SerializeFocusCamera.js +2 -2
  34. package/lib/ValueObjects/Angle.d.ts +8 -0
  35. package/lib/ValueObjects/Angle.js +22 -0
  36. package/lib/ValueObjects/Color.d.ts +23 -0
  37. package/lib/ValueObjects/Color.js +791 -0
  38. package/lib/ValueObjects/LineSegment2D.d.ts +12 -0
  39. package/lib/ValueObjects/LineSegment2D.js +55 -0
  40. package/lib/ValueObjects/ParametricLine.d.ts +27 -0
  41. package/lib/ValueObjects/ParametricLine.js +66 -0
  42. package/lib/ValueObjects/ParametricPlane.d.ts +20 -0
  43. package/lib/ValueObjects/ParametricPlane.js +64 -0
  44. package/lib/ValueObjects/Vector2.d.ts +22 -0
  45. package/lib/ValueObjects/Vector2.js +87 -0
  46. package/lib/ValueObjects/Vector3.d.ts +25 -0
  47. package/lib/ValueObjects/Vector3.js +91 -0
  48. package/lib/ValueObjects/index.d.ts +7 -0
  49. package/lib/ValueObjects/index.js +19 -0
  50. package/lib/index.d.ts +2 -0
  51. package/lib/index.js +3 -1
  52. package/package.json +1 -1
@@ -1,4 +1,5 @@
1
- import { FocusCamera, Vector3 } from "../../Entities";
1
+ import { FocusCamera } from "../../Entities";
2
+ import { Vector3 } from "../../ValueObjects";
2
3
  export declare class BumpDollyFocusCamera {
3
4
  private focusCamera;
4
5
  bumpDurationMS: number;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BumpDollyFocusCamera = void 0;
4
+ const ValueObjects_1 = require("../../ValueObjects");
4
5
  class BumpDollyFocusCamera {
5
6
  constructor(focusCamera) {
6
7
  this.focusCamera = focusCamera;
@@ -25,10 +26,10 @@ class BumpDollyFocusCamera {
25
26
  this.focusCamera.radius = this.initialRadius + range * percent;
26
27
  if (this.pickPoint !== undefined) {
27
28
  const percentChange = this.focusCamera.radius / currentRadius;
28
- const pickToTarget = this.focusCamera.target.subtract(this.pickPoint);
29
+ let pickToTarget = ValueObjects_1.Vector3.subtract(this.focusCamera.target, this.pickPoint);
29
30
  const newLength = pickToTarget.magnitued * percentChange;
30
- pickToTarget.setLength(newLength);
31
- const newTargetPos = this.pickPoint.add(pickToTarget);
31
+ pickToTarget = ValueObjects_1.Vector3.newVectorOfLength(pickToTarget, newLength);
32
+ const newTargetPos = ValueObjects_1.Vector3.add(this.pickPoint, pickToTarget);
32
33
  this.focusCamera.target = newTargetPos;
33
34
  }
34
35
  if (nomralizedTime >= 1 && this.interval) {
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LerpFocusCamera = void 0;
4
- const Entities_1 = require("../../Entities");
4
+ const ValueObjects_1 = require("../../ValueObjects");
5
5
  class LerpFocusCamera {
6
6
  constructor(focusCamera, easeFn, parameters) {
7
7
  var _a, _b, _c;
@@ -30,7 +30,7 @@ class LerpFocusCamera {
30
30
  const x = this.lerpX(percent);
31
31
  const y = this.lerpY(percent);
32
32
  const z = this.lerpZ(percent);
33
- this.focusCamera.target = new Entities_1.Vector3(x, y, z);
33
+ this.focusCamera.target = new ValueObjects_1.Vector3(x, y, z);
34
34
  if (nomralizedTime >= 1) {
35
35
  clearInterval(this.interval);
36
36
  if (this.onComplete) {
@@ -1,4 +1,5 @@
1
- import { FocusCamera, Vector3 } from "../../Entities";
1
+ import { FocusCamera } from "../../Entities";
2
+ import { Vector3 } from "../../ValueObjects";
2
3
  export declare class PinchDollyFocusCamera {
3
4
  private focusCamera;
4
5
  sensitivity: number;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PinchDollyFocusCamera = void 0;
4
+ const ValueObjects_1 = require("../../ValueObjects");
4
5
  class PinchDollyFocusCamera {
5
6
  constructor(focusCamera) {
6
7
  this.focusCamera = focusCamera;
@@ -13,10 +14,10 @@ class PinchDollyFocusCamera {
13
14
  this.focusCamera.radius = currentRadius - deltaRadius;
14
15
  if (this.pickPoint !== undefined) {
15
16
  const percentChange = this.focusCamera.radius / currentRadius;
16
- const pickToTarget = this.focusCamera.target.subtract(this.pickPoint);
17
+ let pickToTarget = ValueObjects_1.Vector3.subtract(this.focusCamera.target, this.pickPoint);
17
18
  const newLength = pickToTarget.magnitued * percentChange;
18
- pickToTarget.setLength(newLength);
19
- const newTargetPos = this.pickPoint.add(pickToTarget);
19
+ pickToTarget = ValueObjects_1.Vector3.newVectorOfLength(pickToTarget, newLength);
20
+ const newTargetPos = ValueObjects_1.Vector3.add(this.pickPoint, pickToTarget);
20
21
  this.focusCamera.target = newTargetPos;
21
22
  }
22
23
  this.previousDistanceBetweenTouches = distanceBetweenTouches;
@@ -1,4 +1,5 @@
1
- import { FocusCamera, Vector2, Vector3 } from "../../Entities";
1
+ import { FocusCamera } from "../../Entities";
2
+ import { Vector2, Vector3 } from "../../ValueObjects";
2
3
  export declare class PixelDollyFocusCamera {
3
4
  private focusCamera;
4
5
  sensitivity: number;
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PixelDollyFocusCamera = void 0;
4
- const Entities_1 = require("../../Entities");
4
+ const ValueObjects_1 = require("../../ValueObjects");
5
5
  class PixelDollyFocusCamera {
6
6
  constructor(focusCamera) {
7
7
  this.focusCamera = focusCamera;
8
8
  this.sensitivity = 0.05;
9
- this.previousPixelPosition = Entities_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;
@@ -14,10 +14,10 @@ class PixelDollyFocusCamera {
14
14
  this.focusCamera.radius = currentRadius - deltaRadius;
15
15
  if (this.pickPoint !== undefined) {
16
16
  const percentChange = this.focusCamera.radius / currentRadius;
17
- const pickToTarget = this.focusCamera.target.subtract(this.pickPoint);
17
+ let pickToTarget = ValueObjects_1.Vector3.subtract(this.focusCamera.target, this.pickPoint);
18
18
  const newLength = pickToTarget.magnitued * percentChange;
19
- pickToTarget.setLength(newLength);
20
- const newTargetPos = this.pickPoint.add(pickToTarget);
19
+ pickToTarget = ValueObjects_1.Vector3.newVectorOfLength(pickToTarget, newLength);
20
+ const newTargetPos = ValueObjects_1.Vector3.add(this.pickPoint, pickToTarget);
21
21
  this.focusCamera.target = newTargetPos;
22
22
  }
23
23
  this.previousPixelPosition = pixelPosition;
@@ -1,4 +1,5 @@
1
- import { FocusCamera, Vector2, Vector3 } from "../../Entities";
1
+ import { FocusCamera } from "../../Entities";
2
+ import { Vector2, Vector3 } from "../../ValueObjects";
2
3
  export declare class PixelOrbitFocusCamera {
3
4
  private focusCamera;
4
5
  sensitivity: number;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PixelOrbitFocusCamera = void 0;
4
+ const ValueObjects_1 = require("../../ValueObjects");
4
5
  class PixelOrbitFocusCamera {
5
6
  constructor(focusCamera) {
6
7
  this.focusCamera = focusCamera;
@@ -9,7 +10,7 @@ class PixelOrbitFocusCamera {
9
10
  if (!this.previousPixelPos) {
10
11
  throw new Error("[PixelOrbitFocusCamera] You must initialize first!");
11
12
  }
12
- const pixelChange = pixelPosition.subtract(this.previousPixelPos);
13
+ const pixelChange = ValueObjects_1.Vector2.subtract(pixelPosition, this.previousPixelPos);
13
14
  this.focusCamera.alpha += pixelChange.x * this.sensitivity;
14
15
  this.focusCamera.beta += pixelChange.y * this.sensitivity;
15
16
  this.previousPixelPos = pixelPosition;
@@ -1,4 +1,5 @@
1
- import { Babylon, FocusCamera, ParametricPlane, Vector2 } from "../../Entities";
1
+ import { Babylon, FocusCamera } from "../../Entities";
2
+ import { ParametricPlane, Vector2 } from "../../ValueObjects";
2
3
  export declare class PixelPlanePanFocusCamera {
3
4
  private focusCamera;
4
5
  private babylon;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PixelPlanePanFocusCamera = void 0;
4
- const Entities_1 = require("../../Entities");
4
+ const ValueObjects_1 = require("../../ValueObjects");
5
5
  class PixelPlanePanFocusCamera {
6
6
  constructor(focusCamera, babylon) {
7
7
  this.focusCamera = focusCamera;
@@ -16,10 +16,10 @@ class PixelPlanePanFocusCamera {
16
16
  const p2 = this.plane.intersectLine(finalRay);
17
17
  if (!p1 || !p2)
18
18
  return;
19
- const delta = p2.subtract(p1);
19
+ const delta = ValueObjects_1.Vector3.subtract(p2, p1);
20
20
  const currentTarget = this.focusCamera.target;
21
- const newTarget = new Entities_1.Vector3(currentTarget.x - delta.x, currentTarget.y - delta.y, currentTarget.z - delta.z);
22
- this.focusCamera.target = new Entities_1.Vector3(newTarget.x, newTarget.y, newTarget.z);
21
+ const newTarget = new ValueObjects_1.Vector3(currentTarget.x - delta.x, currentTarget.y - delta.y, currentTarget.z - delta.z);
22
+ this.focusCamera.target = new ValueObjects_1.Vector3(newTarget.x, newTarget.y, newTarget.z);
23
23
  this.previousPixelPos = pixelPosition;
24
24
  };
25
25
  this.initializePan = (initialPixelPos, panPlane) => {
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SerializeFocusCamera = void 0;
4
4
  const _1 = require(".");
5
- const Entities_1 = require("../../Entities");
5
+ const ValueObjects_1 = require("../../ValueObjects");
6
6
  class SerializeFocusCamera {
7
7
  constructor(focusCamera, stateMachine) {
8
8
  this.name = "focusCamera";
@@ -52,7 +52,7 @@ class SerializeFocusCamera {
52
52
  }
53
53
  applyV1Data(data, transitionTime) {
54
54
  const { alpha, beta, radius, target_x, target_y, target_z } = data;
55
- const target = new Entities_1.Vector3(target_x, target_y, target_z);
55
+ const target = new ValueObjects_1.Vector3(target_x, target_y, target_z);
56
56
  if (transitionTime === 0) {
57
57
  this.applyImmediate(alpha, beta, radius, target);
58
58
  }
@@ -0,0 +1,8 @@
1
+ export declare class Angle {
2
+ static fromDegrees(degrees: number): Angle;
3
+ static fromRadians(radians: number): Angle;
4
+ private _degrees;
5
+ get degrees(): number;
6
+ get radians(): number;
7
+ private constructor();
8
+ }
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Angle = void 0;
4
+ class Angle {
5
+ constructor(degrees) {
6
+ this._degrees = 0;
7
+ this._degrees = degrees;
8
+ }
9
+ static fromDegrees(degrees) {
10
+ return new Angle(degrees);
11
+ }
12
+ static fromRadians(radians) {
13
+ return new Angle(radians * 180 / Math.PI);
14
+ }
15
+ get degrees() {
16
+ return this._degrees;
17
+ }
18
+ get radians() {
19
+ return this._degrees * Math.PI / 180;
20
+ }
21
+ }
22
+ exports.Angle = Angle;
@@ -0,0 +1,23 @@
1
+ export declare type BasicColor = "";
2
+ export declare class Color {
3
+ static RGBA(r: number, g: number, b: number, a: number): Color;
4
+ static RGB(r: number, g: number, b: number): Color;
5
+ static Hex(hex: string): Color;
6
+ static X11(name: string): Color;
7
+ static Equal(a: Color, b: Color): boolean;
8
+ private _r;
9
+ private _g;
10
+ private _b;
11
+ private _a;
12
+ get r(): number;
13
+ get g(): number;
14
+ get b(): number;
15
+ get a(): number;
16
+ get rPercent(): number;
17
+ get gPercent(): number;
18
+ get bPercent(): number;
19
+ get aPercent(): number;
20
+ get array(): [number, number, number, number];
21
+ private clampVal;
22
+ private constructor();
23
+ }