@vived/app 2.11.0 → 2.14.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 (58) 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/KeyboardInput.js +1 -1
  8. package/lib/Entities/MemoizedVector2.d.ts +3 -7
  9. package/lib/Entities/MemoizedVector2.js +7 -24
  10. package/lib/Entities/MemoizedVector3.d.ts +3 -9
  11. package/lib/Entities/MemoizedVector3.js +7 -33
  12. package/lib/Entities/MouseInput.d.ts +11 -5
  13. package/lib/Entities/MouseInput.js +24 -9
  14. package/lib/Entities/ParametricLine.d.ts +1 -1
  15. package/lib/Entities/ParametricLine.js +8 -8
  16. package/lib/Entities/ParametricPlane.d.ts +3 -3
  17. package/lib/Entities/ParametricPlane.js +10 -10
  18. package/lib/Entities/TouchInput.d.ts +16 -8
  19. package/lib/Entities/TouchInput.js +56 -27
  20. package/lib/Entities/index.d.ts +0 -6
  21. package/lib/Entities/index.js +0 -6
  22. package/lib/PresentationManagers/FocusCameraPM.d.ts +2 -1
  23. package/lib/PresentationManagers/FocusCameraPM.js +4 -4
  24. package/lib/UseCases/FocusCamera/BumpDollyFocusCamera.d.ts +2 -1
  25. package/lib/UseCases/FocusCamera/BumpDollyFocusCamera.js +4 -3
  26. package/lib/UseCases/FocusCamera/LerpFocusCamera.js +2 -2
  27. package/lib/UseCases/FocusCamera/PinchDollyFocusCamera.d.ts +2 -1
  28. package/lib/UseCases/FocusCamera/PinchDollyFocusCamera.js +4 -3
  29. package/lib/UseCases/FocusCamera/PixelDollyFocusCamera.d.ts +2 -1
  30. package/lib/UseCases/FocusCamera/PixelDollyFocusCamera.js +5 -5
  31. package/lib/UseCases/FocusCamera/PixelOrbitFocusCamera.d.ts +2 -1
  32. package/lib/UseCases/FocusCamera/PixelOrbitFocusCamera.js +2 -1
  33. package/lib/UseCases/FocusCamera/PixelPlanePanFocusCamera.d.ts +2 -1
  34. package/lib/UseCases/FocusCamera/PixelPlanePanFocusCamera.js +4 -4
  35. package/lib/UseCases/FocusCamera/SerializeFocusCamera.js +2 -2
  36. package/lib/Utilities/LengthConverters.d.ts +4 -0
  37. package/lib/Utilities/LengthConverters.js +21 -0
  38. package/lib/Utilities/index.d.ts +1 -0
  39. package/lib/Utilities/index.js +1 -0
  40. package/lib/ValueObjects/Angle.d.ts +8 -0
  41. package/lib/ValueObjects/Angle.js +22 -0
  42. package/lib/ValueObjects/Color.d.ts +23 -0
  43. package/lib/ValueObjects/Color.js +791 -0
  44. package/lib/ValueObjects/LineSegment2D.d.ts +12 -0
  45. package/lib/ValueObjects/LineSegment2D.js +55 -0
  46. package/lib/ValueObjects/ParametricLine.d.ts +27 -0
  47. package/lib/ValueObjects/ParametricLine.js +66 -0
  48. package/lib/ValueObjects/ParametricPlane.d.ts +20 -0
  49. package/lib/ValueObjects/ParametricPlane.js +64 -0
  50. package/lib/ValueObjects/Vector2.d.ts +22 -0
  51. package/lib/ValueObjects/Vector2.js +87 -0
  52. package/lib/ValueObjects/Vector3.d.ts +25 -0
  53. package/lib/ValueObjects/Vector3.js +91 -0
  54. package/lib/ValueObjects/index.d.ts +7 -0
  55. package/lib/ValueObjects/index.js +19 -0
  56. package/lib/index.d.ts +2 -0
  57. package/lib/index.js +3 -1
  58. package/package.json +1 -1
@@ -1,5 +1,4 @@
1
- import { ParametricLine, Vector3 } from ".";
2
- import { Vector2 } from "./Vector2";
1
+ import { ParametricLine, Vector2, Vector3 } from "../ValueObjects";
3
2
  export declare type OnBabylonChange = () => void;
4
3
  export interface ScenePick {
5
4
  mouseRay: ParametricLine;
@@ -1,11 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.makeBabylon = void 0;
4
- const _1 = require(".");
4
+ const ValueObjects_1 = require("../ValueObjects");
5
5
  const MemoizedBoolean_1 = require("./MemoizedBoolean");
6
6
  const MemoizedVector2_1 = require("./MemoizedVector2");
7
7
  const ObserverList_1 = require("./ObserverList");
8
- const Vector2_1 = require("./Vector2");
9
8
  function makeBabylon() {
10
9
  return new BabylonImp();
11
10
  }
@@ -15,13 +14,13 @@ class BabylonImp {
15
14
  this.scenePick = () => {
16
15
  console.warn("orignal scene picker");
17
16
  return {
18
- mouseRay: _1.ParametricLine.Forward(),
17
+ mouseRay: ValueObjects_1.ParametricLine.Forward(),
19
18
  hit: false,
20
19
  };
21
20
  };
22
21
  this.sceneRay = () => {
23
22
  console.warn("orignal scene ray");
24
- return _1.ParametricLine.Forward();
23
+ return ValueObjects_1.ParametricLine.Forward();
25
24
  };
26
25
  this.observers = new ObserverList_1.ObserverList();
27
26
  this.updateCanvasSize = () => {
@@ -79,7 +78,7 @@ class BabylonImp {
79
78
  this.sceneRay = rayer;
80
79
  };
81
80
  this.memoizedShowInspector = new MemoizedBoolean_1.MemoizedBoolean(false, this.observers.notify);
82
- this.memoizedCanvasSize = new MemoizedVector2_1.MemoizedVector2(Vector2_1.Vector2.One(), this.observers.notify);
81
+ this.memoizedCanvasSize = new MemoizedVector2_1.MemoizedVector2(ValueObjects_1.Vector2.one(), this.observers.notify);
83
82
  }
84
83
  get showInspector() {
85
84
  return this.memoizedShowInspector.val;
@@ -91,9 +90,9 @@ class BabylonImp {
91
90
  return this._renderCanvas;
92
91
  }
93
92
  get canvasSize() {
94
- return this.memoizedCanvasSize.getVector();
93
+ return this.memoizedCanvasSize.val;
95
94
  }
96
95
  set canvasSize(val) {
97
- this.memoizedCanvasSize.setVector(val);
96
+ this.memoizedCanvasSize.val = val;
98
97
  }
99
98
  }
@@ -1,4 +1,4 @@
1
- import { Vector2 } from ".";
1
+ import { Vector2 } from "../ValueObjects";
2
2
  export declare type OnDevicePreviewChange = () => void;
3
3
  export interface DevicePreview {
4
4
  useDevicePreview: boolean;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.makeDevicePreview = void 0;
4
4
  const _1 = require(".");
5
+ const ValueObjects_1 = require("../ValueObjects");
5
6
  function makeDevicePreview() {
6
7
  return new DevicePreviewImp();
7
8
  }
@@ -10,21 +11,20 @@ class DevicePreviewImp {
10
11
  constructor() {
11
12
  this.observers = new _1.ObserverList();
12
13
  this._usePreview = false;
13
- this._previewSize = _1.Vector2.Zero();
14
+ this._previewSize = ValueObjects_1.Vector2.zero();
14
15
  this.setDevicePreview = (x, y) => {
15
16
  if (this._usePreview &&
16
17
  this._previewSize.x === x &&
17
18
  this._previewSize.y === y)
18
19
  return;
19
20
  this._usePreview = true;
20
- this._previewSize.x = x;
21
- this._previewSize.y = y;
21
+ this._previewSize = new ValueObjects_1.Vector2(x, y);
22
22
  this.observers.notify();
23
23
  };
24
24
  this.clearDevicePreview = () => {
25
25
  if (!this._usePreview)
26
26
  return;
27
- this._previewSize = _1.Vector2.Zero();
27
+ this._previewSize = ValueObjects_1.Vector2.zero();
28
28
  this._usePreview = false;
29
29
  this.observers.notify();
30
30
  };
@@ -39,6 +39,6 @@ class DevicePreviewImp {
39
39
  return this._usePreview;
40
40
  }
41
41
  get previewSize() {
42
- return this._previewSize.copy();
42
+ return this._previewSize;
43
43
  }
44
44
  }
@@ -1,4 +1,4 @@
1
- import { Vector3 } from ".";
1
+ import { Vector3 } from "../ValueObjects";
2
2
  export declare type OnFocusCameraChange = () => void;
3
3
  export interface FocusCameraLerper {
4
4
  cancelLerp: () => void;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.makeFocusCamera = void 0;
4
4
  const _1 = require(".");
5
+ const ValueObjects_1 = require("../ValueObjects");
5
6
  function makeFocusCamera() {
6
7
  return new FocusCameraImp();
7
8
  }
@@ -13,7 +14,7 @@ class FocusCameraImp {
13
14
  this.defaultAlpha = 0;
14
15
  this.defaultBeta = 30;
15
16
  this.defaultRadius = 8;
16
- this.defaultTarget = _1.Vector3.Zero();
17
+ this.defaultTarget = ValueObjects_1.Vector3.zero();
17
18
  this.limitRadius = false;
18
19
  this.minRadius = 0;
19
20
  this.maxRadius = 0;
@@ -24,13 +25,13 @@ class FocusCameraImp {
24
25
  this.minBeta = 0;
25
26
  this.maxBeta = 0;
26
27
  this.limitTarget = false;
27
- this.maxTargetPosition = _1.Vector3.Zero();
28
- this.minTargetPosition = _1.Vector3.Zero();
28
+ this.maxTargetPosition = ValueObjects_1.Vector3.zero();
29
+ this.minTargetPosition = ValueObjects_1.Vector3.zero();
29
30
  this.observers = new _1.ObserverList();
30
31
  this.memoizedAlpha = new _1.MemoizedNumber(0, this.observers.notify);
31
32
  this.memoizedBeta = new _1.MemoizedNumber(0, this.observers.notify);
32
33
  this.memoizedRadius = new _1.MemoizedNumber(1, this.observers.notify);
33
- this.memoizedTarget = new _1.MemoizedVector3(_1.Vector3.Zero(), this.observers.notify);
34
+ this.memoizedTarget = new _1.MemoizedVector3(ValueObjects_1.Vector3.zero(), this.observers.notify);
34
35
  this.setRadiusLimits = (min, max) => {
35
36
  if (min < 0) {
36
37
  throw new Error("[Orbit Camera] Mininum Radius must be greater >= 0");
@@ -89,8 +90,8 @@ class FocusCameraImp {
89
90
  this.limitBeta = false;
90
91
  };
91
92
  this.setTargetLimits = (min, max) => {
92
- const minArray = min.asArray();
93
- const maxArray = max.asArray();
93
+ const minArray = min.array;
94
+ const maxArray = max.array;
94
95
  for (let i = 0; i < 3; i++) {
95
96
  if (minArray[i] > maxArray[i]) {
96
97
  throw new Error("[Orbit Camera] Min target must be less than the max target");
@@ -102,8 +103,8 @@ class FocusCameraImp {
102
103
  this.target = this.target;
103
104
  };
104
105
  this.clearTargetLimits = () => {
105
- this.maxTargetPosition = _1.Vector3.Zero();
106
- this.minTargetPosition = _1.Vector3.Zero();
106
+ this.maxTargetPosition = ValueObjects_1.Vector3.zero();
107
+ this.minTargetPosition = ValueObjects_1.Vector3.zero();
107
108
  this.limitTarget = false;
108
109
  };
109
110
  this.registerLerp = (lerper) => {
@@ -132,7 +133,7 @@ class FocusCameraImp {
132
133
  }
133
134
  if (data.defaultTarget !== undefined) {
134
135
  const { x, y, z } = data.defaultTarget;
135
- this.defaultTarget = new _1.Vector3(x, y, z);
136
+ this.defaultTarget = new ValueObjects_1.Vector3(x, y, z);
136
137
  }
137
138
  if (data.nearClip !== undefined) {
138
139
  this.nearClip = data.nearClip;
@@ -151,7 +152,7 @@ class FocusCameraImp {
151
152
  }
152
153
  if (data.targetLimit !== undefined) {
153
154
  const { max, min } = data.targetLimit;
154
- this.setTargetLimits(new _1.Vector3(min.x, min.y, min.z), new _1.Vector3(max.x, max.y, max.z));
155
+ this.setTargetLimits(new ValueObjects_1.Vector3(min.x, min.y, min.z), new ValueObjects_1.Vector3(max.x, max.y, max.z));
155
156
  }
156
157
  };
157
158
  this.addObserver = (observer) => {
@@ -195,13 +196,13 @@ class FocusCameraImp {
195
196
  this.memoizedRadius.val = clampedVal;
196
197
  }
197
198
  get target() {
198
- return this.memoizedTarget.getVector();
199
+ return this.memoizedTarget.val;
199
200
  }
200
201
  set target(val) {
201
- const targetVals = val.asArray();
202
+ const targetVals = val.array;
202
203
  if (this.limitTarget) {
203
- const maxVals = this.maxTargetPosition.asArray();
204
- const minVals = this.minTargetPosition.asArray();
204
+ const maxVals = this.maxTargetPosition.array;
205
+ const minVals = this.minTargetPosition.array;
205
206
  for (let i = 0; i < 3; i++) {
206
207
  let v = targetVals[i];
207
208
  v = Math.min(v, maxVals[i]);
@@ -209,7 +210,7 @@ class FocusCameraImp {
209
210
  targetVals[i] = v;
210
211
  }
211
212
  }
212
- this.memoizedTarget.setVector(new _1.Vector3(targetVals[0], targetVals[1], targetVals[2]));
213
+ this.memoizedTarget.val = ValueObjects_1.Vector3.fromArray(targetVals);
213
214
  }
214
215
  get direction() {
215
216
  const yLength = -Math.sin(this.degToRad(this.beta));
@@ -217,12 +218,11 @@ class FocusCameraImp {
217
218
  const alphaRadians = this.degToRad(this.alpha);
218
219
  const xLength = -horizontalLenght * Math.sin(alphaRadians);
219
220
  const zLength = horizontalLenght * Math.cos(alphaRadians);
220
- return new _1.Vector3(xLength, yLength, zLength);
221
+ return new ValueObjects_1.Vector3(xLength, yLength, zLength);
221
222
  }
222
223
  get cameraPosition() {
223
- const localOffset = this.direction.copy();
224
- localOffset.setLength(-this.radius);
225
- return this.target.add(localOffset);
224
+ const localOffset = ValueObjects_1.Vector3.newVectorOfLength(this.direction, -this.radius);
225
+ return ValueObjects_1.Vector3.add(this.target, localOffset);
226
226
  }
227
227
  degToRad(degrees) {
228
228
  return (degrees * Math.PI) / 180;
@@ -20,8 +20,8 @@ class KeyboardInputImp {
20
20
  return;
21
21
  this._eventElement.removeEventListener("keydown", this.submitKeyDown);
22
22
  this._eventElement.removeEventListener("keyup", this.submitKeyUp);
23
+ this._eventElement = undefined;
23
24
  };
24
- this.pressedKeys = [];
25
25
  this.submitKeyDown = (e) => {
26
26
  e.preventDefault();
27
27
  this.controllers.forEach((c) => {
@@ -1,12 +1,8 @@
1
- import { Vector2 } from "./Vector2";
1
+ import { Vector2 } from "../ValueObjects";
2
2
  export declare class MemoizedVector2 {
3
3
  private _val;
4
- get x(): number;
5
- set x(x: number);
6
- get y(): number;
7
- set y(y: number);
8
- getVector(): Vector2;
9
- setVector(vec: Vector2): void;
4
+ get val(): Vector2;
5
+ set val(v: Vector2);
10
6
  private onChangeCallback;
11
7
  constructor(initialValue: Vector2, onChangeCallback: () => void);
12
8
  }
@@ -1,36 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MemoizedVector2 = void 0;
4
+ const ValueObjects_1 = require("../ValueObjects");
4
5
  class MemoizedVector2 {
5
6
  constructor(initialValue, onChangeCallback) {
6
- this._val = initialValue.copy();
7
+ this._val = initialValue;
7
8
  this.onChangeCallback = onChangeCallback;
8
9
  }
9
- get x() {
10
- return this._val.x;
10
+ get val() {
11
+ return this._val;
11
12
  }
12
- set x(x) {
13
- if (this._val.x === x)
13
+ set val(v) {
14
+ if (ValueObjects_1.Vector2.equal(v, this._val))
14
15
  return;
15
- this._val.x = x;
16
- this.onChangeCallback();
17
- }
18
- get y() {
19
- return this._val.y;
20
- }
21
- set y(y) {
22
- if (this._val.y === y)
23
- return;
24
- this._val.y = y;
25
- this.onChangeCallback();
26
- }
27
- getVector() {
28
- return this._val.copy();
29
- }
30
- setVector(vec) {
31
- if (vec.x === this._val.x && vec.y === this._val.y)
32
- return;
33
- this._val = vec.copy();
16
+ this._val = v;
34
17
  this.onChangeCallback();
35
18
  }
36
19
  }
@@ -1,14 +1,8 @@
1
- import { Vector3 } from "./Vector3";
1
+ import { Vector3 } from "../ValueObjects/Vector3";
2
2
  export declare class MemoizedVector3 {
3
3
  private _val;
4
- get x(): number;
5
- set x(x: number);
6
- get y(): number;
7
- set y(y: number);
8
- get z(): number;
9
- set z(z: number);
10
- getVector(): Vector3;
11
- setVector(vec: Vector3): void;
4
+ get val(): Vector3;
5
+ set val(v: Vector3);
12
6
  private onChangeCallback;
13
7
  constructor(initialValue: Vector3, onChangeCallback: () => void);
14
8
  }
@@ -1,45 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MemoizedVector3 = void 0;
4
+ const Vector3_1 = require("../ValueObjects/Vector3");
4
5
  class MemoizedVector3 {
5
6
  constructor(initialValue, onChangeCallback) {
6
- this._val = initialValue.copy();
7
+ this._val = initialValue;
7
8
  this.onChangeCallback = onChangeCallback;
8
9
  }
9
- get x() {
10
- return this._val.x;
10
+ get val() {
11
+ return this._val;
11
12
  }
12
- set x(x) {
13
- if (this._val.x === x)
13
+ set val(v) {
14
+ if (Vector3_1.Vector3.equal(v, this._val))
14
15
  return;
15
- this._val.x = x;
16
- this.onChangeCallback();
17
- }
18
- get y() {
19
- return this._val.y;
20
- }
21
- set y(y) {
22
- if (this._val.y === y)
23
- return;
24
- this._val.y = y;
25
- this.onChangeCallback();
26
- }
27
- get z() {
28
- return this._val.z;
29
- }
30
- set z(z) {
31
- if (this._val.z === z)
32
- return;
33
- this._val.z = z;
34
- this.onChangeCallback();
35
- }
36
- getVector() {
37
- return this._val.copy();
38
- }
39
- setVector(vec) {
40
- if (vec.x === this._val.x && vec.y === this._val.y && vec.z === this._val.z)
41
- return;
42
- this._val = vec.copy();
16
+ this._val = v;
43
17
  this.onChangeCallback();
44
18
  }
45
19
  }
@@ -1,9 +1,15 @@
1
+ import { Vector2 } from "../ValueObjects";
2
+ export interface MouseInputEvent {
3
+ position: Vector2;
4
+ button: number;
5
+ event: MouseEvent;
6
+ }
1
7
  export interface MouseController {
2
- onClick?: (e: MouseEvent) => void;
3
- onDown?: (e: MouseEvent) => void;
4
- onUp?: (e: MouseEvent) => void;
5
- onMove?: (e: MouseEvent) => void;
6
- onWheel?: (e: WheelEvent) => void;
8
+ onClick?: (e: MouseInputEvent) => void;
9
+ onDown?: (e: MouseInputEvent) => void;
10
+ onUp?: (e: MouseInputEvent) => void;
11
+ onMove?: (e: MouseInputEvent) => void;
12
+ onWheel?: (e: MouseInputEvent) => void;
7
13
  }
8
14
  export interface MouseInput {
9
15
  eventElement: HTMLElement | undefined;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.makeMouseInput = void 0;
4
- const _1 = require(".");
4
+ const ValueObjects_1 = require("../ValueObjects");
5
5
  function makeMouseInput() {
6
6
  return new MouseInputImp();
7
7
  }
@@ -43,9 +43,10 @@ class MouseInputImp {
43
43
  };
44
44
  this.onMouseDown = (e) => {
45
45
  e.preventDefault();
46
+ const inputEvt = this.makeMouseInputEvent(e);
46
47
  this.controllers.forEach((c) => {
47
48
  if (c.onDown) {
48
- c.onDown(e);
49
+ c.onDown(inputEvt);
49
50
  }
50
51
  });
51
52
  this.isPressed = true;
@@ -53,9 +54,10 @@ class MouseInputImp {
53
54
  };
54
55
  this.onMouseUp = (e) => {
55
56
  e.preventDefault();
57
+ const inputEvt = this.makeMouseInputEvent(e);
56
58
  this.controllers.forEach((c) => {
57
59
  if (c.onUp) {
58
- c.onUp(e);
60
+ c.onUp(inputEvt);
59
61
  }
60
62
  });
61
63
  this.isPressed = false;
@@ -63,11 +65,11 @@ class MouseInputImp {
63
65
  return;
64
66
  const deltaX = this.pressEvent.screenX - e.screenX;
65
67
  const deltaY = this.pressEvent.screenY - e.screenY;
66
- const delta = new _1.Vector2(deltaX, deltaY);
68
+ const delta = new ValueObjects_1.Vector2(deltaX, deltaY);
67
69
  if (delta.magnitued < this.maxClickMovement) {
68
70
  this.controllers.forEach((c) => {
69
71
  if (c.onClick) {
70
- c.onClick(e);
72
+ c.onClick(inputEvt);
71
73
  }
72
74
  });
73
75
  }
@@ -75,16 +77,17 @@ class MouseInputImp {
75
77
  };
76
78
  this.onMouseMove = (e) => {
77
79
  e.preventDefault();
80
+ const inputEvt = this.makeMouseInputEvent(e);
78
81
  this.controllers.forEach((c) => {
79
82
  if (c.onMove) {
80
- c.onMove(e);
83
+ c.onMove(inputEvt);
81
84
  }
82
85
  });
83
86
  if (!this.pressEvent)
84
87
  return;
85
88
  const deltaX = this.pressEvent.screenX - e.screenX;
86
89
  const deltaY = this.pressEvent.screenY - e.screenY;
87
- const delta = new _1.Vector2(deltaX, deltaY);
90
+ const delta = new ValueObjects_1.Vector2(deltaX, deltaY);
88
91
  if (delta.magnitued > this.maxClickMovement) {
89
92
  this.pressEvent = undefined;
90
93
  }
@@ -93,9 +96,10 @@ class MouseInputImp {
93
96
  e.preventDefault();
94
97
  if (!this.isPressed)
95
98
  return;
99
+ const inputEvt = this.makeMouseInputEvent(e);
96
100
  this.controllers.forEach((c) => {
97
101
  if (c.onUp) {
98
- c.onUp(e);
102
+ c.onUp(inputEvt);
99
103
  }
100
104
  });
101
105
  this.pressEvent = undefined;
@@ -103,9 +107,10 @@ class MouseInputImp {
103
107
  };
104
108
  this.onWheel = (e) => {
105
109
  e.preventDefault();
110
+ const inputEvt = this.makeMouseInputEvent(e);
106
111
  this.controllers.forEach((c) => {
107
112
  if (c.onWheel) {
108
- c.onWheel(e);
113
+ c.onWheel(inputEvt);
109
114
  }
110
115
  });
111
116
  };
@@ -113,4 +118,14 @@ class MouseInputImp {
113
118
  get eventElement() {
114
119
  return this._eventElement;
115
120
  }
121
+ makeMouseInputEvent(event) {
122
+ const px = event.offsetX;
123
+ const py = event.offsetY;
124
+ const button = event.button;
125
+ return {
126
+ position: new ValueObjects_1.Vector2(px, py),
127
+ button,
128
+ event,
129
+ };
130
+ }
116
131
  }
@@ -1,4 +1,4 @@
1
- import { Vector3 } from "./Vector3";
1
+ import { Vector3 } from "../ValueObjects/Vector3";
2
2
  export interface LineParameters {
3
3
  x0: number;
4
4
  y0: number;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ParametricLine = void 0;
4
- const Vector3_1 = require("./Vector3");
4
+ const Vector3_1 = require("../ValueObjects/Vector3");
5
5
  class ParametricLine {
6
6
  constructor(parameters) {
7
7
  this.x0 = parameters.x0;
@@ -12,7 +12,7 @@ class ParametricLine {
12
12
  this.c = parameters.c;
13
13
  }
14
14
  static FromTwoPoint(p1, p2) {
15
- const dir = p2.subtract(p1).unit;
15
+ const dir = Vector3_1.Vector3.subtract(p2, p1).unit;
16
16
  return this.FromPointDirection(p1, dir);
17
17
  }
18
18
  static FromPointDirection(point, direction) {
@@ -26,32 +26,32 @@ class ParametricLine {
26
26
  });
27
27
  }
28
28
  static Forward() {
29
- const p = Vector3_1.Vector3.Zero();
29
+ const p = Vector3_1.Vector3.zero();
30
30
  const d = new Vector3_1.Vector3(0, 0, 1);
31
31
  return this.FromPointDirection(p, d);
32
32
  }
33
33
  static Backward() {
34
- const p = Vector3_1.Vector3.Zero();
34
+ const p = Vector3_1.Vector3.zero();
35
35
  const d = new Vector3_1.Vector3(0, 0, -1);
36
36
  return this.FromPointDirection(p, d);
37
37
  }
38
38
  static Up() {
39
- const p = Vector3_1.Vector3.Zero();
39
+ const p = Vector3_1.Vector3.zero();
40
40
  const d = new Vector3_1.Vector3(0, 1, 0);
41
41
  return this.FromPointDirection(p, d);
42
42
  }
43
43
  static Down() {
44
- const p = Vector3_1.Vector3.Zero();
44
+ const p = Vector3_1.Vector3.zero();
45
45
  const d = new Vector3_1.Vector3(0, -1, 0);
46
46
  return this.FromPointDirection(p, d);
47
47
  }
48
48
  static Left() {
49
- const p = Vector3_1.Vector3.Zero();
49
+ const p = Vector3_1.Vector3.zero();
50
50
  const d = new Vector3_1.Vector3(-1, 0, 0);
51
51
  return this.FromPointDirection(p, d);
52
52
  }
53
53
  static Right() {
54
- const p = Vector3_1.Vector3.Zero();
54
+ const p = Vector3_1.Vector3.zero();
55
55
  const d = new Vector3_1.Vector3(1, 0, 0);
56
56
  return this.FromPointDirection(p, d);
57
57
  }
@@ -1,5 +1,5 @@
1
1
  import { ParametricLine } from "./ParametricLine";
2
- import { Vector3 } from "./Vector3";
2
+ import { Vector3 } from "../ValueObjects/Vector3";
3
3
  export interface PlaneParameters {
4
4
  a: number;
5
5
  b: number;
@@ -7,13 +7,13 @@ export interface PlaneParameters {
7
7
  d: number;
8
8
  }
9
9
  export declare class ParametricPlane {
10
+ private point;
11
+ private normal;
10
12
  static FromPointNormal(point: Vector3, normal: Vector3): ParametricPlane;
11
13
  static FromThreePoints(A: Vector3, B: Vector3, C: Vector3): ParametricPlane;
12
14
  static XY(): ParametricPlane;
13
15
  static ZX(): ParametricPlane;
14
16
  static YZ(): ParametricPlane;
15
- private point;
16
- private normal;
17
17
  getParameters(): PlaneParameters;
18
18
  intersectLine(line: ParametricLine): Vector3 | undefined;
19
19
  constructor(point: Vector3, normal: Vector3);
@@ -1,34 +1,34 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ParametricPlane = void 0;
4
- const Vector3_1 = require("./Vector3");
4
+ const Vector3_1 = require("../ValueObjects/Vector3");
5
5
  class ParametricPlane {
6
6
  constructor(point, normal) {
7
- this.point = point.copy();
8
- this.normal = normal.copy();
7
+ this.point = point;
8
+ this.normal = normal;
9
9
  }
10
10
  static FromPointNormal(point, normal) {
11
11
  return new ParametricPlane(point, normal);
12
12
  }
13
13
  static FromThreePoints(A, B, C) {
14
14
  const point = A;
15
- const AB = B.subtract(A);
16
- const AC = C.subtract(A);
17
- const normal = AB.cross(AC);
15
+ const AB = Vector3_1.Vector3.subtract(B, A);
16
+ const AC = Vector3_1.Vector3.subtract(C, A);
17
+ const normal = Vector3_1.Vector3.cross(AB, AC);
18
18
  return new ParametricPlane(point, normal);
19
19
  }
20
20
  static XY() {
21
- const p = Vector3_1.Vector3.Zero();
21
+ const p = Vector3_1.Vector3.zero();
22
22
  const n = new Vector3_1.Vector3(0, 0, 1);
23
23
  return new ParametricPlane(p, n);
24
24
  }
25
25
  static ZX() {
26
- const p = Vector3_1.Vector3.Zero();
26
+ const p = Vector3_1.Vector3.zero();
27
27
  const n = new Vector3_1.Vector3(0, 1, 0);
28
28
  return new ParametricPlane(p, n);
29
29
  }
30
30
  static YZ() {
31
- const p = Vector3_1.Vector3.Zero();
31
+ const p = Vector3_1.Vector3.zero();
32
32
  const n = new Vector3_1.Vector3(1, 0, 0);
33
33
  return new ParametricPlane(p, n);
34
34
  }
@@ -36,7 +36,7 @@ class ParametricPlane {
36
36
  const a = this.normal.x;
37
37
  const b = this.normal.y;
38
38
  const c = this.normal.z;
39
- let d = this.point.dot(this.normal);
39
+ let d = Vector3_1.Vector3.dot(this.point, this.normal);
40
40
  if (d !== 0) {
41
41
  d *= -1;
42
42
  }