vim-web 0.3.40 → 0.3.42
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/dist/types/core-viewers/ultra/index.d.ts +1 -0
- package/dist/types/core-viewers/ultra/viewer/logger.d.ts +1 -1
- package/dist/types/core-viewers/ultra/viewer/renderer.d.ts +3 -1
- package/dist/types/core-viewers/ultra/viewer/rpcClient.d.ts +1 -0
- package/dist/types/core-viewers/ultra/viewer/rpcSafeClient.d.ts +8 -3
- package/dist/types/core-viewers/ultra/viewer/viewer.d.ts +3 -3
- package/dist/types/core-viewers/ultra/viewer/viewport.d.ts +3 -1
- package/dist/types/core-viewers/ultra/viewer/vim.d.ts +4 -4
- package/dist/types/core-viewers/webgl/viewer/gizmos/sectionBox/sectionBoxInputs.d.ts +1 -0
- package/dist/types/react-viewers/ultra/errors/serverFileDownloadingError.d.ts +1 -1
- package/dist/types/react-viewers/ultra/errors/ultraErrors.d.ts +1 -1
- package/dist/types/react-viewers/ultra/ultraComponent.d.ts +1 -1
- package/dist/vim-web.iife.js +102 -53
- package/dist/vim-web.iife.js.map +1 -1
- package/dist/vim-web.js +102 -53
- package/dist/vim-web.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { RGBA } from "../utils/math3d";
|
|
2
|
+
import { ILogger } from "./logger";
|
|
2
3
|
import { RpcSafeClient, SceneSettings } from "./rpcSafeClient";
|
|
3
4
|
import { ClientStreamError } from "./socketClient";
|
|
4
5
|
/**
|
|
@@ -32,6 +33,7 @@ export interface IRenderer {
|
|
|
32
33
|
*/
|
|
33
34
|
export declare class Renderer implements IRenderer {
|
|
34
35
|
private _rpc;
|
|
36
|
+
private _logger;
|
|
35
37
|
private _settings;
|
|
36
38
|
private _animationFrame;
|
|
37
39
|
private _updateLighting;
|
|
@@ -42,7 +44,7 @@ export declare class Renderer implements IRenderer {
|
|
|
42
44
|
* @param rpc - RPC client for communication with the rendering backend
|
|
43
45
|
* @param settings - Optional partial render settings to override defaults
|
|
44
46
|
*/
|
|
45
|
-
constructor(rpc: RpcSafeClient, settings?: Partial<RenderSettings>);
|
|
47
|
+
constructor(rpc: RpcSafeClient, logger: ILogger, settings?: Partial<RenderSettings>);
|
|
46
48
|
/**
|
|
47
49
|
* Validates the connection to the server by attempting to start a scene.
|
|
48
50
|
* @returns A promise that resolves to a ClientStreamError if the connection fails, or undefined if successful.
|
|
@@ -18,6 +18,7 @@ export declare const materialHandles: MaterialHandle[];
|
|
|
18
18
|
export declare class RpcClient {
|
|
19
19
|
private readonly _messenger;
|
|
20
20
|
get url(): string;
|
|
21
|
+
get connected(): boolean;
|
|
21
22
|
constructor(_messenger: SocketClient);
|
|
22
23
|
readonly API_VERSION = "5.0.0";
|
|
23
24
|
RPCAddNodeFlags(componentHandle: number, nodes: number[], flags: number): void;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { Box3, RGBA, RGBA32, Segment, Vector2, Vector3 } from "../utils/math3d";
|
|
2
2
|
import { HitCheckResult } from "./marshal";
|
|
3
3
|
import { MaterialHandle, RpcClient } from "./rpcClient";
|
|
4
|
+
export type VimSource = {
|
|
5
|
+
url: string;
|
|
6
|
+
authToken?: string;
|
|
7
|
+
};
|
|
4
8
|
export type VimLoadingState = {
|
|
5
9
|
status: VimLoadingStatus;
|
|
6
10
|
progress: number;
|
|
@@ -34,6 +38,7 @@ export declare class RpcSafeClient {
|
|
|
34
38
|
private readonly rpc;
|
|
35
39
|
private readonly batchSize;
|
|
36
40
|
get url(): string;
|
|
41
|
+
get connected(): boolean;
|
|
37
42
|
constructor(rpc: RpcClient, batchSize?: number);
|
|
38
43
|
/*******************************************************************************
|
|
39
44
|
* SCENE MANAGEMENT METHODS
|
|
@@ -213,18 +218,18 @@ export declare class RpcSafeClient {
|
|
|
213
218
|
******************************************************************************/
|
|
214
219
|
/**
|
|
215
220
|
* Loads a VIM file from the local filesystem.
|
|
216
|
-
* @param
|
|
221
|
+
* @param source - The path to the VIM file (supports file:// protocol)
|
|
217
222
|
* @returns Promise resolving to the handle of the loaded VIM component
|
|
218
223
|
* @throws {Error} If the filename is invalid or empty
|
|
219
224
|
*/
|
|
220
|
-
RPCLoadVim(
|
|
225
|
+
RPCLoadVim(source: VimSource): Promise<number>;
|
|
221
226
|
/**
|
|
222
227
|
* Loads a VIM file from a remote URL.
|
|
223
228
|
* @param url - The URL of the VIM file to load
|
|
224
229
|
* @returns Promise resolving to the handle of the loaded VIM component
|
|
225
230
|
* @throws {Error} If the URL is invalid
|
|
226
231
|
*/
|
|
227
|
-
RPCLoadVimURL(
|
|
232
|
+
RPCLoadVimURL(source: VimSource): Promise<number>;
|
|
228
233
|
/**
|
|
229
234
|
* Retrieves the current loading state and progress of a VIM component.
|
|
230
235
|
* @param componentHandle - The handle of the VIM component
|
|
@@ -7,7 +7,7 @@ import { ILogger } from './logger';
|
|
|
7
7
|
import { IViewport } from './viewport';
|
|
8
8
|
import { ColorManager } from './colorManager';
|
|
9
9
|
import { ICamera } from './camera';
|
|
10
|
-
import { RpcSafeClient } from './rpcSafeClient';
|
|
10
|
+
import { RpcSafeClient, VimSource } from './rpcSafeClient';
|
|
11
11
|
import { ISimpleEvent } from 'ste-simple-events';
|
|
12
12
|
import { IReadonlyVimCollection } from './vimCollection';
|
|
13
13
|
import { IRenderer } from './renderer';
|
|
@@ -104,10 +104,10 @@ export declare class Viewer {
|
|
|
104
104
|
disconnect(): void;
|
|
105
105
|
/**
|
|
106
106
|
* Requests the server to load the given URL or file path.
|
|
107
|
-
* @param
|
|
107
|
+
* @param source - The path or URL to the VIM file.
|
|
108
108
|
* @returns A load request object that can be used to wait for the load to complete.
|
|
109
109
|
*/
|
|
110
|
-
loadVim(
|
|
110
|
+
loadVim(source: VimSource): ILoadRequest;
|
|
111
111
|
/**
|
|
112
112
|
* Unloads the given VIM from the viewer.
|
|
113
113
|
* @param vim - The VIM instance to unload.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ILogger } from "./logger";
|
|
1
2
|
import { RpcSafeClient } from "./rpcSafeClient";
|
|
2
3
|
/**
|
|
3
4
|
* Interface defining viewport functionality
|
|
@@ -15,6 +16,7 @@ export declare class Viewport {
|
|
|
15
16
|
/** The HTML canvas element used for rendering */
|
|
16
17
|
canvas: HTMLCanvasElement;
|
|
17
18
|
private _rpc;
|
|
19
|
+
private _logger;
|
|
18
20
|
private _observer;
|
|
19
21
|
private _clearTimeout;
|
|
20
22
|
/**
|
|
@@ -22,7 +24,7 @@ export declare class Viewport {
|
|
|
22
24
|
* @param canvas - The HTML canvas element to observe and manage
|
|
23
25
|
* @param rpc - RPC client for viewport communication
|
|
24
26
|
*/
|
|
25
|
-
constructor(canvas: HTMLCanvasElement, rpc: RpcSafeClient);
|
|
27
|
+
constructor(canvas: HTMLCanvasElement, rpc: RpcSafeClient, logger: ILogger);
|
|
26
28
|
/**
|
|
27
29
|
* Handles resize events for the canvas
|
|
28
30
|
* @private
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { ColorHandle } from './color';
|
|
2
2
|
import { ColorManager } from './colorManager';
|
|
3
3
|
import { LoadRequest } from './loadRequest';
|
|
4
|
-
import { RpcSafeClient } from './rpcSafeClient';
|
|
4
|
+
import { RpcSafeClient, VimSource } from './rpcSafeClient';
|
|
5
5
|
import { ILogger } from './logger';
|
|
6
6
|
import { Box3 } from '../utils/math3d';
|
|
7
7
|
type NodeState = 'visible' | 'hidden' | 'ghosted' | 'highlighted';
|
|
8
8
|
export declare class Vim {
|
|
9
|
-
readonly source:
|
|
9
|
+
readonly source: VimSource;
|
|
10
10
|
private _handle;
|
|
11
11
|
private _request;
|
|
12
12
|
private readonly _rpc;
|
|
@@ -24,7 +24,7 @@ export declare class Vim {
|
|
|
24
24
|
* @param source - The source URL or file path of the Vim.
|
|
25
25
|
* @param logger - The logger for logging messages.
|
|
26
26
|
*/
|
|
27
|
-
constructor(rpc: RpcSafeClient, color: ColorManager, source:
|
|
27
|
+
constructor(rpc: RpcSafeClient, color: ColorManager, source: VimSource, logger: ILogger);
|
|
28
28
|
get handle(): number;
|
|
29
29
|
/**
|
|
30
30
|
* Indicates whether the Vim is connected.
|
|
@@ -44,7 +44,7 @@ export declare class Vim {
|
|
|
44
44
|
disconnect(): void;
|
|
45
45
|
/**
|
|
46
46
|
* Requests for the server to load the given URL or file path.
|
|
47
|
-
* @param
|
|
47
|
+
* @param source - The URL or file path to load.
|
|
48
48
|
* @param result - The load request object to update.
|
|
49
49
|
* @returns The updated load request.
|
|
50
50
|
*/
|
|
@@ -26,6 +26,7 @@ export declare class BoxInputs {
|
|
|
26
26
|
constructor(viewer: Viewer, cube: THREE.Object3D, box: THREE.Box3);
|
|
27
27
|
private reg;
|
|
28
28
|
register(): void;
|
|
29
|
+
onPointerLeave(event: PointerEvent): void;
|
|
29
30
|
capturePointer(pointerId: number): void;
|
|
30
31
|
releasePointer(): void;
|
|
31
32
|
unregister(): void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { MessageBoxProps } from '../../panels/messageBox';
|
|
2
|
-
export declare function serverFileDownloadingError(url: string, server?: string): MessageBoxProps;
|
|
2
|
+
export declare function serverFileDownloadingError(url: string, authToken?: string, server?: string): MessageBoxProps;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as Ultra from '../../../core-viewers/ultra';
|
|
2
2
|
export declare function getErrorMessage(state: Ultra.ClientState): import("../..").MessageBoxProps;
|
|
3
|
-
export declare function getRequestErrorMessage(
|
|
3
|
+
export declare function getRequestErrorMessage(source: Ultra.VimSource, error: Ultra.VimRequestErrorType): import("../..").MessageBoxProps;
|
|
@@ -5,7 +5,7 @@ export type UltraComponentRef = {
|
|
|
5
5
|
viewer: Ultra.Viewer;
|
|
6
6
|
modal: ModalRef;
|
|
7
7
|
dispose: () => void;
|
|
8
|
-
load(url:
|
|
8
|
+
load(url: Ultra.VimSource): Ultra.ILoadRequest;
|
|
9
9
|
};
|
|
10
10
|
/**
|
|
11
11
|
* Creates a UI container along with a VIM.Viewer and its associated React component.
|
package/dist/vim-web.iife.js
CHANGED
|
@@ -50168,10 +50168,10 @@ data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAGQCAYAAACAvzbMAAAAAXNSR0IArs
|
|
|
50168
50168
|
background: { color: new Color(12698310) },
|
|
50169
50169
|
skybox: {
|
|
50170
50170
|
enable: true,
|
|
50171
|
-
skyColor: new Color(
|
|
50172
|
-
//
|
|
50173
|
-
groundColor: new Color(
|
|
50174
|
-
//
|
|
50171
|
+
skyColor: new Color(16777215),
|
|
50172
|
+
// white
|
|
50173
|
+
groundColor: new Color(16185078),
|
|
50174
|
+
// less white
|
|
50175
50175
|
sharpness: 2
|
|
50176
50176
|
},
|
|
50177
50177
|
groundPlane: {
|
|
@@ -55236,6 +55236,15 @@ data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAGQCAYAAACAvzbMAAAAAXNSR0IArs
|
|
|
55236
55236
|
this.reg(canvas, "pointerdown", this.onMouseDown.bind(this));
|
|
55237
55237
|
this.reg(canvas, "pointermove", this.onMouseMove.bind(this));
|
|
55238
55238
|
this.reg(canvas, "pointerup", this.onMouseUp.bind(this));
|
|
55239
|
+
this.reg(canvas, "pointerleave", this.onPointerLeave.bind(this));
|
|
55240
|
+
}
|
|
55241
|
+
onPointerLeave(event) {
|
|
55242
|
+
var _a2;
|
|
55243
|
+
if (this.capturedId !== void 0) {
|
|
55244
|
+
return;
|
|
55245
|
+
}
|
|
55246
|
+
this.faceNormal.set(0, 0, 0);
|
|
55247
|
+
(_a2 = this.onFaceEnter) == null ? void 0 : _a2.call(this, this.faceNormal);
|
|
55239
55248
|
}
|
|
55240
55249
|
capturePointer(pointerId) {
|
|
55241
55250
|
this.releasePointer();
|
|
@@ -58127,6 +58136,9 @@ data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAGQCAYAAACAvzbMAAAAAXNSR0IArs
|
|
|
58127
58136
|
get url() {
|
|
58128
58137
|
return this._messenger.url;
|
|
58129
58138
|
}
|
|
58139
|
+
get connected() {
|
|
58140
|
+
return this._messenger.state.status === "connected";
|
|
58141
|
+
}
|
|
58130
58142
|
RPCAddNodeFlags(componentHandle, nodes, flags) {
|
|
58131
58143
|
const marshal = new Marshal();
|
|
58132
58144
|
marshal.writeString("RPCAddNodeFlags");
|
|
@@ -58823,6 +58835,9 @@ data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAGQCAYAAACAvzbMAAAAAXNSR0IArs
|
|
|
58823
58835
|
get url() {
|
|
58824
58836
|
return this.rpc.url;
|
|
58825
58837
|
}
|
|
58838
|
+
get connected() {
|
|
58839
|
+
return this.rpc.connected;
|
|
58840
|
+
}
|
|
58826
58841
|
/*******************************************************************************
|
|
58827
58842
|
* SCENE MANAGEMENT METHODS
|
|
58828
58843
|
* Methods for managing the overall scene, including initialization, lighting,
|
|
@@ -59159,15 +59174,15 @@ data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAGQCAYAAACAvzbMAAAAAXNSR0IArs
|
|
|
59159
59174
|
******************************************************************************/
|
|
59160
59175
|
/**
|
|
59161
59176
|
* Loads a VIM file from the local filesystem.
|
|
59162
|
-
* @param
|
|
59177
|
+
* @param source - The path to the VIM file (supports file:// protocol)
|
|
59163
59178
|
* @returns Promise resolving to the handle of the loaded VIM component
|
|
59164
59179
|
* @throws {Error} If the filename is invalid or empty
|
|
59165
59180
|
*/
|
|
59166
|
-
async RPCLoadVim(
|
|
59167
|
-
if (!Validation.isNonEmptyString(
|
|
59168
|
-
|
|
59181
|
+
async RPCLoadVim(source) {
|
|
59182
|
+
if (!Validation.isNonEmptyString(source.url)) return INVALID_HANDLE;
|
|
59183
|
+
const url = source.url.replace("file:///", "file://");
|
|
59169
59184
|
return await this.safeCall(
|
|
59170
|
-
() => this.rpc.RPCLoadVim(
|
|
59185
|
+
() => this.rpc.RPCLoadVim(url),
|
|
59171
59186
|
INVALID_HANDLE
|
|
59172
59187
|
);
|
|
59173
59188
|
}
|
|
@@ -59177,10 +59192,10 @@ data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAGQCAYAAACAvzbMAAAAAXNSR0IArs
|
|
|
59177
59192
|
* @returns Promise resolving to the handle of the loaded VIM component
|
|
59178
59193
|
* @throws {Error} If the URL is invalid
|
|
59179
59194
|
*/
|
|
59180
|
-
async RPCLoadVimURL(
|
|
59181
|
-
if (!Validation.isURL(url)) return INVALID_HANDLE;
|
|
59195
|
+
async RPCLoadVimURL(source) {
|
|
59196
|
+
if (!Validation.isURL(source.url)) return INVALID_HANDLE;
|
|
59182
59197
|
return await this.safeCall(
|
|
59183
|
-
() => this.rpc.RPCLoadVimURL(url, ""),
|
|
59198
|
+
() => this.rpc.RPCLoadVimURL(source.url, source.authToken ?? ""),
|
|
59184
59199
|
INVALID_HANDLE
|
|
59185
59200
|
);
|
|
59186
59201
|
}
|
|
@@ -59564,9 +59579,9 @@ data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAGQCAYAAACAvzbMAAAAAXNSR0IArs
|
|
|
59564
59579
|
this._inputsMouse = new InputMouse(this._canvas, this._rpc, selection, camera2);
|
|
59565
59580
|
this._inputsTouch = new InputTouch(this._canvas, this._rpc);
|
|
59566
59581
|
this._keyboard = new InputKeyboard(this._rpc, selection, camera2, this);
|
|
59567
|
-
this.register();
|
|
59568
59582
|
}
|
|
59569
59583
|
onConnect() {
|
|
59584
|
+
this.register();
|
|
59570
59585
|
this._rpc.RPCSetMoveSpeed(this._moveSpeed);
|
|
59571
59586
|
}
|
|
59572
59587
|
register() {
|
|
@@ -59812,7 +59827,7 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
59812
59827
|
* Disconnects from the current WebSocket server.
|
|
59813
59828
|
*/
|
|
59814
59829
|
disconnect(error) {
|
|
59815
|
-
this._logger.log("Disconnecting from "
|
|
59830
|
+
this._logger.log("Disconnecting from: ", this._connectingUrl);
|
|
59816
59831
|
this._connectingUrl = void 0;
|
|
59817
59832
|
this._disconnect(error);
|
|
59818
59833
|
}
|
|
@@ -59898,7 +59913,7 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
59898
59913
|
this._disconnect(issues);
|
|
59899
59914
|
return;
|
|
59900
59915
|
}
|
|
59901
|
-
this._logger.log("Connected to "
|
|
59916
|
+
this._logger.log("Connected to: ", (_a2 = this._socket) == null ? void 0 : _a2.url);
|
|
59902
59917
|
this.updateState({ status: "connected" });
|
|
59903
59918
|
this._streamLogger.startLoggging();
|
|
59904
59919
|
this._connectPromise.resolve();
|
|
@@ -60211,7 +60226,10 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
60211
60226
|
this._logger.error("Error decoding video chunk: ", e);
|
|
60212
60227
|
}
|
|
60213
60228
|
}
|
|
60214
|
-
this._firstDecoded
|
|
60229
|
+
if (!this._firstDecoded) {
|
|
60230
|
+
this._firstDecoded = true;
|
|
60231
|
+
this._logger.log("First frame decoded");
|
|
60232
|
+
}
|
|
60215
60233
|
}
|
|
60216
60234
|
/**
|
|
60217
60235
|
* Clears the decoder state and renderer buffer.
|
|
@@ -60421,16 +60439,16 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
60421
60439
|
if (this._request) {
|
|
60422
60440
|
return this._request;
|
|
60423
60441
|
}
|
|
60424
|
-
this._logger.log("Loading "
|
|
60442
|
+
this._logger.log("Loading: ", this.source);
|
|
60425
60443
|
this._request = new LoadRequest$1();
|
|
60426
60444
|
this._load(this.source, this._request).then(async (request2) => {
|
|
60427
60445
|
const result = await request2.getResult();
|
|
60428
60446
|
if (result.isSuccess) {
|
|
60429
|
-
this._logger.log(
|
|
60447
|
+
this._logger.log("Successfully loaded vim: ", this.source);
|
|
60430
60448
|
this.reapplyNodes();
|
|
60431
60449
|
this.reapplyColors();
|
|
60432
60450
|
} else {
|
|
60433
|
-
this._logger.log(
|
|
60451
|
+
this._logger.log("Failed to load vim: ", this.source);
|
|
60434
60452
|
}
|
|
60435
60453
|
});
|
|
60436
60454
|
return this._request;
|
|
@@ -60463,18 +60481,19 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
60463
60481
|
}
|
|
60464
60482
|
/**
|
|
60465
60483
|
* Requests for the server to load the given URL or file path.
|
|
60466
|
-
* @param
|
|
60484
|
+
* @param source - The URL or file path to load.
|
|
60467
60485
|
* @param result - The load request object to update.
|
|
60468
60486
|
* @returns The updated load request.
|
|
60469
60487
|
*/
|
|
60470
|
-
async _load(
|
|
60471
|
-
const handle = await this._getHandle(
|
|
60488
|
+
async _load(source, result) {
|
|
60489
|
+
const handle = await this._getHandle(source, result);
|
|
60472
60490
|
if (result.isCompleted || handle === INVALID_HANDLE) {
|
|
60473
60491
|
return result;
|
|
60474
60492
|
}
|
|
60475
60493
|
while (true) {
|
|
60476
60494
|
try {
|
|
60477
60495
|
const state = await this._rpc.RPCGetVimLoadingState(handle);
|
|
60496
|
+
this._logger.log("state :", state);
|
|
60478
60497
|
result.onProgress(state.progress);
|
|
60479
60498
|
switch (state.status) {
|
|
60480
60499
|
// Keep waiting for the loading to complete
|
|
@@ -60511,16 +60530,16 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
60511
60530
|
return "unknown";
|
|
60512
60531
|
}
|
|
60513
60532
|
}
|
|
60514
|
-
async _getHandle(
|
|
60533
|
+
async _getHandle(source, result) {
|
|
60515
60534
|
let handle = void 0;
|
|
60516
60535
|
try {
|
|
60517
|
-
if (isURL(url)) {
|
|
60518
|
-
handle = await this._rpc.RPCLoadVimURL(
|
|
60519
|
-
} else if (isFileURI(url)) {
|
|
60520
|
-
handle = await this._rpc.RPCLoadVim(
|
|
60536
|
+
if (isURL(source.url)) {
|
|
60537
|
+
handle = await this._rpc.RPCLoadVimURL(source);
|
|
60538
|
+
} else if (isFileURI(source.url)) {
|
|
60539
|
+
handle = await this._rpc.RPCLoadVim(source);
|
|
60521
60540
|
} else {
|
|
60522
60541
|
console.log("Defaulting to file path");
|
|
60523
|
-
handle = await this._rpc.RPCLoadVim(
|
|
60542
|
+
handle = await this._rpc.RPCLoadVim(source);
|
|
60524
60543
|
}
|
|
60525
60544
|
} catch (e) {
|
|
60526
60545
|
result.error("downloadingError", e.message);
|
|
@@ -60530,6 +60549,7 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
60530
60549
|
result.error("downloadingError");
|
|
60531
60550
|
return INVALID_HANDLE;
|
|
60532
60551
|
}
|
|
60552
|
+
console.log("handle :", handle);
|
|
60533
60553
|
return handle;
|
|
60534
60554
|
}
|
|
60535
60555
|
/**
|
|
@@ -60735,13 +60755,27 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
60735
60755
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
60736
60756
|
}
|
|
60737
60757
|
const defaultLogger = {
|
|
60738
|
-
log: (message) => {
|
|
60739
|
-
|
|
60758
|
+
log: (message, obj) => {
|
|
60759
|
+
const caller = getCaller();
|
|
60760
|
+
const msg = `VIM Ultra : ${message}`;
|
|
60761
|
+
if (obj) {
|
|
60762
|
+
console.log(msg, obj, { caller });
|
|
60763
|
+
} else {
|
|
60764
|
+
console.log(msg, { caller });
|
|
60765
|
+
}
|
|
60740
60766
|
},
|
|
60741
60767
|
error: (message, e) => {
|
|
60742
|
-
console.error("VIM Ultra
|
|
60768
|
+
console.error("VIM Ultra " + message, e);
|
|
60743
60769
|
}
|
|
60744
60770
|
};
|
|
60771
|
+
function getCaller() {
|
|
60772
|
+
const stack = new Error().stack;
|
|
60773
|
+
if (!stack) return "";
|
|
60774
|
+
const files = stack.split("/");
|
|
60775
|
+
const file = files[files.length - 1];
|
|
60776
|
+
const clean = file.replace(/\?[^:]+/, "");
|
|
60777
|
+
return clean;
|
|
60778
|
+
}
|
|
60745
60779
|
function debounce(func, delay) {
|
|
60746
60780
|
let timeoutId;
|
|
60747
60781
|
return [function(...args) {
|
|
@@ -60759,14 +60793,16 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
60759
60793
|
* @param canvas - The HTML canvas element to observe and manage
|
|
60760
60794
|
* @param rpc - RPC client for viewport communication
|
|
60761
60795
|
*/
|
|
60762
|
-
constructor(canvas, rpc) {
|
|
60796
|
+
constructor(canvas, rpc, logger) {
|
|
60763
60797
|
/** The HTML canvas element used for rendering */
|
|
60764
60798
|
__publicField(this, "canvas");
|
|
60765
60799
|
__publicField(this, "_rpc");
|
|
60800
|
+
__publicField(this, "_logger");
|
|
60766
60801
|
__publicField(this, "_observer");
|
|
60767
60802
|
__publicField(this, "_clearTimeout");
|
|
60768
60803
|
this.canvas = canvas;
|
|
60769
60804
|
this._rpc = rpc;
|
|
60805
|
+
this._logger = logger;
|
|
60770
60806
|
const [debounced, clear] = debounce(() => this.onResize(), 250);
|
|
60771
60807
|
this._observer = new ResizeObserver(debounced);
|
|
60772
60808
|
this._observer.observe(canvas);
|
|
@@ -60777,14 +60813,16 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
60777
60813
|
* @private
|
|
60778
60814
|
*/
|
|
60779
60815
|
onResize() {
|
|
60780
|
-
|
|
60816
|
+
this._logger.log("Canvas resized to :", { x: this.canvas.offsetWidth, y: this.canvas.offsetHeight });
|
|
60781
60817
|
this.update();
|
|
60782
60818
|
}
|
|
60783
60819
|
/**
|
|
60784
60820
|
* Updates the aspect ratio of the viewport on the server
|
|
60785
60821
|
*/
|
|
60786
60822
|
update() {
|
|
60787
|
-
this._rpc.
|
|
60823
|
+
if (this._rpc.connected) {
|
|
60824
|
+
this._rpc.RPCSetAspectRatio(this.canvas.offsetWidth, this.canvas.offsetHeight);
|
|
60825
|
+
}
|
|
60788
60826
|
}
|
|
60789
60827
|
/**
|
|
60790
60828
|
* Cleans up resources by removing resize observer and clearing timeouts
|
|
@@ -61330,14 +61368,16 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
61330
61368
|
* @param rpc - RPC client for communication with the rendering backend
|
|
61331
61369
|
* @param settings - Optional partial render settings to override defaults
|
|
61332
61370
|
*/
|
|
61333
|
-
constructor(rpc, settings2 = {}) {
|
|
61371
|
+
constructor(rpc, logger, settings2 = {}) {
|
|
61334
61372
|
__publicField(this, "_rpc");
|
|
61373
|
+
__publicField(this, "_logger");
|
|
61335
61374
|
__publicField(this, "_settings");
|
|
61336
61375
|
__publicField(this, "_animationFrame");
|
|
61337
61376
|
__publicField(this, "_updateLighting", false);
|
|
61338
61377
|
__publicField(this, "_updateGhostColor", false);
|
|
61339
61378
|
__publicField(this, "_updateIblRotation", false);
|
|
61340
61379
|
this._rpc = rpc;
|
|
61380
|
+
this._logger = logger;
|
|
61341
61381
|
this._settings = { ...defaultRenderSettings, ...settings2 };
|
|
61342
61382
|
}
|
|
61343
61383
|
/**
|
|
@@ -61346,8 +61386,12 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
61346
61386
|
*/
|
|
61347
61387
|
async validateConnection() {
|
|
61348
61388
|
const success = await this._rpc.RPCStartScene(this._settings);
|
|
61349
|
-
if (success)
|
|
61389
|
+
if (success) {
|
|
61390
|
+
this._logger.log("Scene stream started successfully");
|
|
61391
|
+
return void 0;
|
|
61392
|
+
}
|
|
61350
61393
|
const error = await this._rpc.RPCGetLastError();
|
|
61394
|
+
this._logger.error("Failed to start scene stream", error);
|
|
61351
61395
|
return {
|
|
61352
61396
|
status: "error",
|
|
61353
61397
|
error: "stream",
|
|
@@ -61572,10 +61616,10 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
61572
61616
|
this.rpc = new RpcSafeClient(new RpcClient(this._socketClient));
|
|
61573
61617
|
this._canvas = canvas;
|
|
61574
61618
|
this._vims = new VimCollection();
|
|
61575
|
-
this._viewport = new Viewport(canvas, this.rpc);
|
|
61619
|
+
this._viewport = new Viewport(canvas, this.rpc, this._logger);
|
|
61576
61620
|
this._decoder = new Decoder(canvas, this._logger);
|
|
61577
61621
|
this._selection = new ViewerSelection(this.rpc, this._vims);
|
|
61578
|
-
this._renderer = new Renderer(this.rpc);
|
|
61622
|
+
this._renderer = new Renderer(this.rpc, this._logger);
|
|
61579
61623
|
this.colors = new ColorManager(this.rpc);
|
|
61580
61624
|
this._camera = new Camera(this.rpc);
|
|
61581
61625
|
this._input = new Inputs(canvas, this.rpc, this._selection, this._camera, this._renderer);
|
|
@@ -61684,6 +61728,7 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
61684
61728
|
const remoteVersion = parseVersion(version2);
|
|
61685
61729
|
const localParsedVersion = parseVersion(localVersion);
|
|
61686
61730
|
if (localParsedVersion.major !== remoteVersion.major) {
|
|
61731
|
+
this._logger.error("Major version mismatch", { local: localParsedVersion, remote: remoteVersion });
|
|
61687
61732
|
return {
|
|
61688
61733
|
status: "error",
|
|
61689
61734
|
error: "compatibility",
|
|
@@ -61692,6 +61737,7 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
61692
61737
|
serverVersion: version2
|
|
61693
61738
|
};
|
|
61694
61739
|
}
|
|
61740
|
+
this._logger.log("API version check passed", { local: localParsedVersion, remote: remoteVersion });
|
|
61695
61741
|
return void 0;
|
|
61696
61742
|
}
|
|
61697
61743
|
/**
|
|
@@ -61721,16 +61767,16 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
61721
61767
|
}
|
|
61722
61768
|
/**
|
|
61723
61769
|
* Requests the server to load the given URL or file path.
|
|
61724
|
-
* @param
|
|
61770
|
+
* @param source - The path or URL to the VIM file.
|
|
61725
61771
|
* @returns A load request object that can be used to wait for the load to complete.
|
|
61726
61772
|
*/
|
|
61727
|
-
loadVim(
|
|
61728
|
-
if (typeof
|
|
61773
|
+
loadVim(source) {
|
|
61774
|
+
if (typeof source.url !== "string" || source.url.trim() === "") {
|
|
61729
61775
|
const request22 = new LoadRequest$1();
|
|
61730
61776
|
request22.error("loadingError", "Invalid path");
|
|
61731
61777
|
return request22;
|
|
61732
61778
|
}
|
|
61733
|
-
const vim = new Vim(this.rpc, this.colors,
|
|
61779
|
+
const vim = new Vim(this.rpc, this.colors, source, this._logger);
|
|
61734
61780
|
this._vims.add(vim);
|
|
61735
61781
|
const request2 = vim.connect();
|
|
61736
61782
|
request2.getResult().then((result) => {
|
|
@@ -74215,6 +74261,8 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
74215
74261
|
relay("pointerdown", (s, e) => new PointerEvent(s, e), false);
|
|
74216
74262
|
relay("pointermove", (s, e) => new PointerEvent(s, e), false);
|
|
74217
74263
|
relay("pointerup", (s, e) => new PointerEvent(s, e), false);
|
|
74264
|
+
relay("pointerenter", (s, e) => new PointerEvent(s, e));
|
|
74265
|
+
relay("pointerleave", (s, e) => new PointerEvent(s, e));
|
|
74218
74266
|
relay("touchstart", (s, e) => new TouchEvent(s, e), false);
|
|
74219
74267
|
relay("touchend", (s, e) => new TouchEvent(s, e), false);
|
|
74220
74268
|
relay("touchmove", (s, e) => new TouchEvent(s, e), false);
|
|
@@ -75658,18 +75706,18 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
75658
75706
|
}
|
|
75659
75707
|
return true;
|
|
75660
75708
|
}
|
|
75661
|
-
function serverFileDownloadingError(url, server) {
|
|
75709
|
+
function serverFileDownloadingError(url, authToken, server) {
|
|
75662
75710
|
if (isFilePathOrUri(url)) {
|
|
75663
75711
|
return fileOpeningError(url);
|
|
75664
75712
|
}
|
|
75665
75713
|
return {
|
|
75666
75714
|
title: "File Downloading Error",
|
|
75667
|
-
body: body$4(server,
|
|
75715
|
+
body: body$4(server, authToken, server),
|
|
75668
75716
|
footer: footer(support),
|
|
75669
75717
|
canClose: false
|
|
75670
75718
|
};
|
|
75671
75719
|
}
|
|
75672
|
-
function body$4(server,
|
|
75720
|
+
function body$4(url, server, authToken) {
|
|
75673
75721
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: vcRoboto, children: [
|
|
75674
75722
|
mainText(/* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
75675
75723
|
"Oops, it appears that there’s an ",
|
|
@@ -75679,7 +75727,8 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
75679
75727
|
subTitle("Error details:"),
|
|
75680
75728
|
dotList([
|
|
75681
75729
|
server ? bullet("VIM ULTRA Server:", server) : null,
|
|
75682
|
-
bullet("File URL:", url)
|
|
75730
|
+
bullet("File URL:", url),
|
|
75731
|
+
authToken ? bullet("Auth Token:", authToken) : null
|
|
75683
75732
|
]),
|
|
75684
75733
|
subTitle("Troubleshooting tips:"),
|
|
75685
75734
|
numList([
|
|
@@ -75815,17 +75864,17 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
75815
75864
|
return serverStreamError(state.serverUrl);
|
|
75816
75865
|
}
|
|
75817
75866
|
}
|
|
75818
|
-
function getRequestErrorMessage(
|
|
75867
|
+
function getRequestErrorMessage(source, error) {
|
|
75819
75868
|
console.log(error);
|
|
75820
75869
|
switch (error) {
|
|
75821
75870
|
case "loadingError":
|
|
75822
|
-
return serverFileLoadingError(url);
|
|
75871
|
+
return serverFileLoadingError(source.url);
|
|
75823
75872
|
case "downloadingError":
|
|
75824
75873
|
case "unknown":
|
|
75825
75874
|
case "cancelled":
|
|
75826
|
-
return serverFileDownloadingError(url);
|
|
75875
|
+
return serverFileDownloadingError(source.url);
|
|
75827
75876
|
case "serverDisconnected":
|
|
75828
|
-
return serverConnectionError(url);
|
|
75877
|
+
return serverConnectionError(source.url);
|
|
75829
75878
|
}
|
|
75830
75879
|
}
|
|
75831
75880
|
function createUltraComponent(container) {
|
|
@@ -75880,13 +75929,13 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
75880
75929
|
}
|
|
75881
75930
|
}
|
|
75882
75931
|
function ToRef(viewer, modal) {
|
|
75883
|
-
function load(
|
|
75884
|
-
const request2 = viewer.loadVim(
|
|
75932
|
+
function load(source) {
|
|
75933
|
+
const request2 = viewer.loadVim(source);
|
|
75885
75934
|
void updateProgress(request2, modal);
|
|
75886
75935
|
void request2.getResult().then(
|
|
75887
75936
|
(result) => {
|
|
75888
75937
|
if (result.isError) {
|
|
75889
|
-
modal.message(getRequestErrorMessage(
|
|
75938
|
+
modal.message(getRequestErrorMessage(source, result.error));
|
|
75890
75939
|
return;
|
|
75891
75940
|
}
|
|
75892
75941
|
if (result.isSuccess) {
|