@dreamcomposer/engine-types 2.1.0 → 2.2.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.
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FromEngineMessage } from "../post-messages";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Sent as the very first thing when the engine page starts, before any of
|
|
5
|
+
* its scripts are loaded. It only tells the embedder that the engine is
|
|
6
|
+
* reachable; it is still not allowed to send commands until it receives the
|
|
7
|
+
* `engine-ready` message.
|
|
8
|
+
*/
|
|
9
|
+
export interface EngineAliveMessage extends FromEngineMessage<"engine-alive"> {
|
|
10
|
+
payload: true;
|
|
11
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FromEngineMessage } from "../post-messages";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Sent when the engine fails in a way it cannot recover from on its own.
|
|
5
|
+
*
|
|
6
|
+
* `startup` errors happen before `engine-ready` was sent, i.e. the engine will
|
|
7
|
+
* never become ready. `runtime` errors happen afterwards and leave the engine
|
|
8
|
+
* unusable, e.g. a lost WebGL context that is not restored.
|
|
9
|
+
*/
|
|
10
|
+
export interface EngineErrorMessage extends FromEngineMessage<"engine-error"> {
|
|
11
|
+
payload: {
|
|
12
|
+
phase: "startup" | "runtime";
|
|
13
|
+
/** A technical description for logs, not meant to be shown to users. */
|
|
14
|
+
message: string;
|
|
15
|
+
};
|
|
16
|
+
}
|
package/package.json
CHANGED
package/post-messages.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { AckMessage } from "./from-engine/AckMessage";
|
|
2
2
|
import { CanvasImageUrlMessage } from "./from-engine/CanvasImageUrlMessage";
|
|
3
|
+
import { EngineAliveMessage } from "./from-engine/EngineAliveMessage";
|
|
4
|
+
import { EngineErrorMessage } from "./from-engine/EngineErrorMessage";
|
|
3
5
|
import { EngineReadyMessage } from "./from-engine/EngineReadyMessage";
|
|
4
6
|
import { KeyDownMessage } from "./from-engine/KeyDownMessage";
|
|
5
7
|
import { SetLoadingProgressMessage } from "./from-engine/SetLoadingProgressMessage";
|
|
@@ -82,6 +84,8 @@ export type FromEnginePostMessage =
|
|
|
82
84
|
| AckMessage
|
|
83
85
|
| CanvasImageUrlMessage
|
|
84
86
|
| DisplayLoadingUiMessage
|
|
87
|
+
| EngineAliveMessage
|
|
88
|
+
| EngineErrorMessage
|
|
85
89
|
| EngineReadyMessage
|
|
86
90
|
| HideGuiMessage
|
|
87
91
|
| HideLoadingUiMessage
|
|
@@ -4,8 +4,12 @@ import { ToEngineMessage } from "../post-messages";
|
|
|
4
4
|
* Resets the camera to its initial position.
|
|
5
5
|
*/
|
|
6
6
|
export interface ResetCameraPositionMessage extends ToEngineMessage<"reset-camera-position"> {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
payload: {
|
|
8
|
+
/**
|
|
9
|
+
* When true, the reset additionally restores the camera's default orientation
|
|
10
|
+
* on top of zoom and shift. Defaults to false (zoom/shift only), which keeps
|
|
11
|
+
* the current viewing angle.
|
|
12
|
+
*/
|
|
13
|
+
resetRotation?: boolean;
|
|
14
|
+
};
|
|
11
15
|
}
|
|
@@ -4,8 +4,9 @@ import type { ToEngineMessage } from "../post-messages";
|
|
|
4
4
|
/**
|
|
5
5
|
* Defines the initial geometry rotation and position.
|
|
6
6
|
*
|
|
7
|
-
* The initial transform is used if the transform is reseted.
|
|
7
|
+
* The initial transform is used if the transform is reseted. Setting it also applies it:
|
|
8
|
+
* instantly by default, or as a glide of `transitionDuration` seconds.
|
|
8
9
|
*/
|
|
9
10
|
export interface SetInitialGeometryTransformMessage extends ToEngineMessage<"set-initial-geometry-transform"> {
|
|
10
|
-
payload: { transform: GeometryTransform };
|
|
11
|
+
payload: { transform: GeometryTransform; transitionDuration?: number };
|
|
11
12
|
}
|