@vived/app 2.17.0 → 2.18.2
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.
package/lib/Entities/Babylon.js
CHANGED
|
@@ -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)
|
|
@@ -35,7 +35,8 @@ class TouchInputImp {
|
|
|
35
35
|
this._eventElement = eventElement;
|
|
36
36
|
};
|
|
37
37
|
this.onTouchStart = (e) => {
|
|
38
|
-
e.
|
|
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.
|
|
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.
|
|
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.
|
|
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) {
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Vector3 } from "../ValueObjects";
|
|
2
|
+
export interface LerpVector3DTO {
|
|
3
|
+
initial: Vector3;
|
|
4
|
+
final: Vector3;
|
|
5
|
+
durationMS: number;
|
|
6
|
+
tickInterval?: number;
|
|
7
|
+
ease?: (percent: number) => number;
|
|
8
|
+
onTick?: (v: Vector3) => void;
|
|
9
|
+
onComplete?: () => void;
|
|
10
|
+
onCanceled?: () => void;
|
|
11
|
+
}
|
|
12
|
+
export declare class LerpVector3 {
|
|
13
|
+
private initial;
|
|
14
|
+
private final;
|
|
15
|
+
private durationMS;
|
|
16
|
+
private tickInterval;
|
|
17
|
+
private ease;
|
|
18
|
+
private onTick;
|
|
19
|
+
private onComplete;
|
|
20
|
+
private onCanceled;
|
|
21
|
+
private interval?;
|
|
22
|
+
private chrono;
|
|
23
|
+
cancel: () => void;
|
|
24
|
+
private tick;
|
|
25
|
+
constructor(lerpParams: LerpVector3DTO);
|
|
26
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LerpVector3 = void 0;
|
|
4
|
+
const ValueObjects_1 = require("../ValueObjects");
|
|
5
|
+
class LerpVector3 {
|
|
6
|
+
constructor(lerpParams) {
|
|
7
|
+
this.tickInterval = 10;
|
|
8
|
+
this.ease = (p) => p;
|
|
9
|
+
this.onTick = () => {
|
|
10
|
+
// Override as needed
|
|
11
|
+
};
|
|
12
|
+
this.onComplete = () => {
|
|
13
|
+
// Override as needed
|
|
14
|
+
};
|
|
15
|
+
this.onCanceled = () => {
|
|
16
|
+
// Override as needed
|
|
17
|
+
};
|
|
18
|
+
this.chrono = 0;
|
|
19
|
+
this.cancel = () => {
|
|
20
|
+
if (this.interval) {
|
|
21
|
+
clearInterval(this.interval);
|
|
22
|
+
this.onCanceled();
|
|
23
|
+
this.interval = undefined;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
this.tick = () => {
|
|
27
|
+
this.chrono = this.chrono + this.tickInterval;
|
|
28
|
+
let nomralizedTime = this.chrono / this.durationMS;
|
|
29
|
+
if (nomralizedTime > 1) {
|
|
30
|
+
nomralizedTime = 1;
|
|
31
|
+
}
|
|
32
|
+
const percent = this.ease(nomralizedTime);
|
|
33
|
+
const lerpedVec = ValueObjects_1.Vector3.Lerp(this.initial, this.final, percent);
|
|
34
|
+
this.onTick(lerpedVec);
|
|
35
|
+
if (nomralizedTime >= 1 && this.interval) {
|
|
36
|
+
clearInterval(this.interval);
|
|
37
|
+
this.interval = undefined;
|
|
38
|
+
if (this.onComplete) {
|
|
39
|
+
this.onComplete();
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
this.initial = lerpParams.initial;
|
|
44
|
+
this.final = lerpParams.final;
|
|
45
|
+
this.durationMS = lerpParams.durationMS;
|
|
46
|
+
if (lerpParams.onTick) {
|
|
47
|
+
this.onTick = lerpParams.onTick;
|
|
48
|
+
}
|
|
49
|
+
if (lerpParams.tickInterval) {
|
|
50
|
+
this.tickInterval = lerpParams.tickInterval;
|
|
51
|
+
}
|
|
52
|
+
if (lerpParams.onComplete) {
|
|
53
|
+
this.onComplete = lerpParams.onComplete;
|
|
54
|
+
}
|
|
55
|
+
if (lerpParams.ease) {
|
|
56
|
+
this.ease = lerpParams.ease;
|
|
57
|
+
}
|
|
58
|
+
if (lerpParams.onCanceled) {
|
|
59
|
+
this.onCanceled = lerpParams.onCanceled;
|
|
60
|
+
}
|
|
61
|
+
this.interval = setInterval(() => {
|
|
62
|
+
this.tick();
|
|
63
|
+
}, this.tickInterval);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
exports.LerpVector3 = LerpVector3;
|
package/lib/UseCases/index.d.ts
CHANGED
package/lib/UseCases/index.js
CHANGED
|
@@ -13,3 +13,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
13
13
|
__exportStar(require("./setDevicePreview"), exports);
|
|
14
14
|
__exportStar(require("./FocusCamera"), exports);
|
|
15
15
|
__exportStar(require("./QuestionChallenge"), exports);
|
|
16
|
+
__exportStar(require("./LerpVector3"), exports);
|