vim-web 0.3.40 → 0.3.42-dev.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.
- package/dist/types/core-viewers/ultra/index.d.ts +2 -1
- 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/socketClient.d.ts +7 -1
- package/dist/types/core-viewers/ultra/viewer/viewer.d.ts +5 -6
- 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 +122 -63
- package/dist/vim-web.iife.js.map +1 -1
- package/dist/vim-web.js +122 -63
- package/dist/vim-web.js.map +1 -1
- package/package.json +1 -1
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() {
|
|
@@ -59705,6 +59720,7 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
59705
59720
|
ControllablePromise,
|
|
59706
59721
|
ResolvedPromise
|
|
59707
59722
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
59723
|
+
const DEFAULT_LOCAL_ULTRA_SERVER_URL = "ws://localhost:8123";
|
|
59708
59724
|
class SocketClient {
|
|
59709
59725
|
/**
|
|
59710
59726
|
* Constructs a new Messenger instance.
|
|
@@ -59719,6 +59735,7 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
59719
59735
|
__publicField(this, "_rpcCallId", 0);
|
|
59720
59736
|
__publicField(this, "_reconnectTimeout");
|
|
59721
59737
|
__publicField(this, "_connectionTimeout");
|
|
59738
|
+
__publicField(this, "_attempts", -1);
|
|
59722
59739
|
__publicField(this, "_validateConnection");
|
|
59723
59740
|
/**
|
|
59724
59741
|
* Callback function to handle incoming video frames.
|
|
@@ -59769,7 +59786,12 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
59769
59786
|
* @param url - The WebSocket URL to connect to.
|
|
59770
59787
|
* @returns A promise that resolves when the connection is established.
|
|
59771
59788
|
*/
|
|
59772
|
-
connect(
|
|
59789
|
+
connect(settings2) {
|
|
59790
|
+
settings2 = {
|
|
59791
|
+
url: (settings2 == null ? void 0 : settings2.url) ?? DEFAULT_LOCAL_ULTRA_SERVER_URL,
|
|
59792
|
+
attempts: (settings2 == null ? void 0 : settings2.attempts) ?? 0
|
|
59793
|
+
};
|
|
59794
|
+
const url = settings2.url;
|
|
59773
59795
|
if (!isWebSocketUrl(url)) {
|
|
59774
59796
|
this._disconnect({ status: "error", error: "connection", serverUrl: url });
|
|
59775
59797
|
return Promise.reject(new Error(`Invalid WebSocket URL: ${url}`));
|
|
@@ -59812,7 +59834,7 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
59812
59834
|
* Disconnects from the current WebSocket server.
|
|
59813
59835
|
*/
|
|
59814
59836
|
disconnect(error) {
|
|
59815
|
-
this._logger.log("Disconnecting from "
|
|
59837
|
+
this._logger.log("Disconnecting from: ", this._connectingUrl);
|
|
59816
59838
|
this._connectingUrl = void 0;
|
|
59817
59839
|
this._disconnect(error);
|
|
59818
59840
|
}
|
|
@@ -59898,7 +59920,7 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
59898
59920
|
this._disconnect(issues);
|
|
59899
59921
|
return;
|
|
59900
59922
|
}
|
|
59901
|
-
this._logger.log("Connected to "
|
|
59923
|
+
this._logger.log("Connected to: ", (_a2 = this._socket) == null ? void 0 : _a2.url);
|
|
59902
59924
|
this.updateState({ status: "connected" });
|
|
59903
59925
|
this._streamLogger.startLoggging();
|
|
59904
59926
|
this._connectPromise.resolve();
|
|
@@ -59911,11 +59933,16 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
59911
59933
|
clearTimeout(this._connectionTimeout);
|
|
59912
59934
|
this._disconnect({ status: "error", error: "connection", serverUrl: this._connectingUrl });
|
|
59913
59935
|
this._logger.log("WebSocket closed.");
|
|
59914
|
-
this.
|
|
59915
|
-
|
|
59916
|
-
this.
|
|
59917
|
-
|
|
59918
|
-
|
|
59936
|
+
if (this._attempts != 0) {
|
|
59937
|
+
this._logger.log("Attempting to reconnect in 5 seconds");
|
|
59938
|
+
this._reconnectTimeout = setTimeout(() => {
|
|
59939
|
+
this.updateState({ status: "connecting" });
|
|
59940
|
+
this.connect({
|
|
59941
|
+
url: this._connectingUrl,
|
|
59942
|
+
attempts: this._attempts - 1
|
|
59943
|
+
});
|
|
59944
|
+
}, 5e3);
|
|
59945
|
+
}
|
|
59919
59946
|
}
|
|
59920
59947
|
/**
|
|
59921
59948
|
* Sends binary data over the WebSocket connection.
|
|
@@ -60211,7 +60238,10 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
60211
60238
|
this._logger.error("Error decoding video chunk: ", e);
|
|
60212
60239
|
}
|
|
60213
60240
|
}
|
|
60214
|
-
this._firstDecoded
|
|
60241
|
+
if (!this._firstDecoded) {
|
|
60242
|
+
this._firstDecoded = true;
|
|
60243
|
+
this._logger.log("First frame decoded");
|
|
60244
|
+
}
|
|
60215
60245
|
}
|
|
60216
60246
|
/**
|
|
60217
60247
|
* Clears the decoder state and renderer buffer.
|
|
@@ -60421,16 +60451,16 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
60421
60451
|
if (this._request) {
|
|
60422
60452
|
return this._request;
|
|
60423
60453
|
}
|
|
60424
|
-
this._logger.log("Loading "
|
|
60454
|
+
this._logger.log("Loading: ", this.source);
|
|
60425
60455
|
this._request = new LoadRequest$1();
|
|
60426
60456
|
this._load(this.source, this._request).then(async (request2) => {
|
|
60427
60457
|
const result = await request2.getResult();
|
|
60428
60458
|
if (result.isSuccess) {
|
|
60429
|
-
this._logger.log(
|
|
60459
|
+
this._logger.log("Successfully loaded vim: ", this.source);
|
|
60430
60460
|
this.reapplyNodes();
|
|
60431
60461
|
this.reapplyColors();
|
|
60432
60462
|
} else {
|
|
60433
|
-
this._logger.log(
|
|
60463
|
+
this._logger.log("Failed to load vim: ", this.source);
|
|
60434
60464
|
}
|
|
60435
60465
|
});
|
|
60436
60466
|
return this._request;
|
|
@@ -60463,18 +60493,19 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
60463
60493
|
}
|
|
60464
60494
|
/**
|
|
60465
60495
|
* Requests for the server to load the given URL or file path.
|
|
60466
|
-
* @param
|
|
60496
|
+
* @param source - The URL or file path to load.
|
|
60467
60497
|
* @param result - The load request object to update.
|
|
60468
60498
|
* @returns The updated load request.
|
|
60469
60499
|
*/
|
|
60470
|
-
async _load(
|
|
60471
|
-
const handle = await this._getHandle(
|
|
60500
|
+
async _load(source, result) {
|
|
60501
|
+
const handle = await this._getHandle(source, result);
|
|
60472
60502
|
if (result.isCompleted || handle === INVALID_HANDLE) {
|
|
60473
60503
|
return result;
|
|
60474
60504
|
}
|
|
60475
60505
|
while (true) {
|
|
60476
60506
|
try {
|
|
60477
60507
|
const state = await this._rpc.RPCGetVimLoadingState(handle);
|
|
60508
|
+
this._logger.log("state :", state);
|
|
60478
60509
|
result.onProgress(state.progress);
|
|
60479
60510
|
switch (state.status) {
|
|
60480
60511
|
// Keep waiting for the loading to complete
|
|
@@ -60511,16 +60542,16 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
60511
60542
|
return "unknown";
|
|
60512
60543
|
}
|
|
60513
60544
|
}
|
|
60514
|
-
async _getHandle(
|
|
60545
|
+
async _getHandle(source, result) {
|
|
60515
60546
|
let handle = void 0;
|
|
60516
60547
|
try {
|
|
60517
|
-
if (isURL(url)) {
|
|
60518
|
-
handle = await this._rpc.RPCLoadVimURL(
|
|
60519
|
-
} else if (isFileURI(url)) {
|
|
60520
|
-
handle = await this._rpc.RPCLoadVim(
|
|
60548
|
+
if (isURL(source.url)) {
|
|
60549
|
+
handle = await this._rpc.RPCLoadVimURL(source);
|
|
60550
|
+
} else if (isFileURI(source.url)) {
|
|
60551
|
+
handle = await this._rpc.RPCLoadVim(source);
|
|
60521
60552
|
} else {
|
|
60522
60553
|
console.log("Defaulting to file path");
|
|
60523
|
-
handle = await this._rpc.RPCLoadVim(
|
|
60554
|
+
handle = await this._rpc.RPCLoadVim(source);
|
|
60524
60555
|
}
|
|
60525
60556
|
} catch (e) {
|
|
60526
60557
|
result.error("downloadingError", e.message);
|
|
@@ -60530,6 +60561,7 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
60530
60561
|
result.error("downloadingError");
|
|
60531
60562
|
return INVALID_HANDLE;
|
|
60532
60563
|
}
|
|
60564
|
+
console.log("handle :", handle);
|
|
60533
60565
|
return handle;
|
|
60534
60566
|
}
|
|
60535
60567
|
/**
|
|
@@ -60735,13 +60767,27 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
60735
60767
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
60736
60768
|
}
|
|
60737
60769
|
const defaultLogger = {
|
|
60738
|
-
log: (message) => {
|
|
60739
|
-
|
|
60770
|
+
log: (message, obj) => {
|
|
60771
|
+
const caller = getCaller();
|
|
60772
|
+
const msg = `VIM Ultra : ${message}`;
|
|
60773
|
+
if (obj) {
|
|
60774
|
+
console.log(msg, obj, { caller });
|
|
60775
|
+
} else {
|
|
60776
|
+
console.log(msg, { caller });
|
|
60777
|
+
}
|
|
60740
60778
|
},
|
|
60741
60779
|
error: (message, e) => {
|
|
60742
|
-
console.error("VIM Ultra
|
|
60780
|
+
console.error("VIM Ultra " + message, e);
|
|
60743
60781
|
}
|
|
60744
60782
|
};
|
|
60783
|
+
function getCaller() {
|
|
60784
|
+
const stack = new Error().stack;
|
|
60785
|
+
if (!stack) return "";
|
|
60786
|
+
const files = stack.split("/");
|
|
60787
|
+
const file = files[files.length - 1];
|
|
60788
|
+
const clean = file.replace(/\?[^:]+/, "");
|
|
60789
|
+
return clean;
|
|
60790
|
+
}
|
|
60745
60791
|
function debounce(func, delay) {
|
|
60746
60792
|
let timeoutId;
|
|
60747
60793
|
return [function(...args) {
|
|
@@ -60759,14 +60805,16 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
60759
60805
|
* @param canvas - The HTML canvas element to observe and manage
|
|
60760
60806
|
* @param rpc - RPC client for viewport communication
|
|
60761
60807
|
*/
|
|
60762
|
-
constructor(canvas, rpc) {
|
|
60808
|
+
constructor(canvas, rpc, logger) {
|
|
60763
60809
|
/** The HTML canvas element used for rendering */
|
|
60764
60810
|
__publicField(this, "canvas");
|
|
60765
60811
|
__publicField(this, "_rpc");
|
|
60812
|
+
__publicField(this, "_logger");
|
|
60766
60813
|
__publicField(this, "_observer");
|
|
60767
60814
|
__publicField(this, "_clearTimeout");
|
|
60768
60815
|
this.canvas = canvas;
|
|
60769
60816
|
this._rpc = rpc;
|
|
60817
|
+
this._logger = logger;
|
|
60770
60818
|
const [debounced, clear] = debounce(() => this.onResize(), 250);
|
|
60771
60819
|
this._observer = new ResizeObserver(debounced);
|
|
60772
60820
|
this._observer.observe(canvas);
|
|
@@ -60777,14 +60825,16 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
60777
60825
|
* @private
|
|
60778
60826
|
*/
|
|
60779
60827
|
onResize() {
|
|
60780
|
-
|
|
60828
|
+
this._logger.log("Canvas resized to :", { x: this.canvas.offsetWidth, y: this.canvas.offsetHeight });
|
|
60781
60829
|
this.update();
|
|
60782
60830
|
}
|
|
60783
60831
|
/**
|
|
60784
60832
|
* Updates the aspect ratio of the viewport on the server
|
|
60785
60833
|
*/
|
|
60786
60834
|
update() {
|
|
60787
|
-
this._rpc.
|
|
60835
|
+
if (this._rpc.connected) {
|
|
60836
|
+
this._rpc.RPCSetAspectRatio(this.canvas.offsetWidth, this.canvas.offsetHeight);
|
|
60837
|
+
}
|
|
60788
60838
|
}
|
|
60789
60839
|
/**
|
|
60790
60840
|
* Cleans up resources by removing resize observer and clearing timeouts
|
|
@@ -61330,14 +61380,16 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
61330
61380
|
* @param rpc - RPC client for communication with the rendering backend
|
|
61331
61381
|
* @param settings - Optional partial render settings to override defaults
|
|
61332
61382
|
*/
|
|
61333
|
-
constructor(rpc, settings2 = {}) {
|
|
61383
|
+
constructor(rpc, logger, settings2 = {}) {
|
|
61334
61384
|
__publicField(this, "_rpc");
|
|
61385
|
+
__publicField(this, "_logger");
|
|
61335
61386
|
__publicField(this, "_settings");
|
|
61336
61387
|
__publicField(this, "_animationFrame");
|
|
61337
61388
|
__publicField(this, "_updateLighting", false);
|
|
61338
61389
|
__publicField(this, "_updateGhostColor", false);
|
|
61339
61390
|
__publicField(this, "_updateIblRotation", false);
|
|
61340
61391
|
this._rpc = rpc;
|
|
61392
|
+
this._logger = logger;
|
|
61341
61393
|
this._settings = { ...defaultRenderSettings, ...settings2 };
|
|
61342
61394
|
}
|
|
61343
61395
|
/**
|
|
@@ -61346,8 +61398,12 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
61346
61398
|
*/
|
|
61347
61399
|
async validateConnection() {
|
|
61348
61400
|
const success = await this._rpc.RPCStartScene(this._settings);
|
|
61349
|
-
if (success)
|
|
61401
|
+
if (success) {
|
|
61402
|
+
this._logger.log("Scene stream started successfully");
|
|
61403
|
+
return void 0;
|
|
61404
|
+
}
|
|
61350
61405
|
const error = await this._rpc.RPCGetLastError();
|
|
61406
|
+
this._logger.error("Failed to start scene stream", error);
|
|
61351
61407
|
return {
|
|
61352
61408
|
status: "error",
|
|
61353
61409
|
error: "stream",
|
|
@@ -61539,7 +61595,6 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
61539
61595
|
}
|
|
61540
61596
|
}
|
|
61541
61597
|
}
|
|
61542
|
-
const DEFAULT_LOCAL_ULTRA_SERVER_URL = "ws://localhost:8123";
|
|
61543
61598
|
const INVALID_HANDLE = 4294967295;
|
|
61544
61599
|
class Viewer {
|
|
61545
61600
|
/**
|
|
@@ -61572,10 +61627,10 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
61572
61627
|
this.rpc = new RpcSafeClient(new RpcClient(this._socketClient));
|
|
61573
61628
|
this._canvas = canvas;
|
|
61574
61629
|
this._vims = new VimCollection();
|
|
61575
|
-
this._viewport = new Viewport(canvas, this.rpc);
|
|
61630
|
+
this._viewport = new Viewport(canvas, this.rpc, this._logger);
|
|
61576
61631
|
this._decoder = new Decoder(canvas, this._logger);
|
|
61577
61632
|
this._selection = new ViewerSelection(this.rpc, this._vims);
|
|
61578
|
-
this._renderer = new Renderer(this.rpc);
|
|
61633
|
+
this._renderer = new Renderer(this.rpc, this._logger);
|
|
61579
61634
|
this.colors = new ColorManager(this.rpc);
|
|
61580
61635
|
this._camera = new Camera(this.rpc);
|
|
61581
61636
|
this._input = new Inputs(canvas, this.rpc, this._selection, this._camera, this._renderer);
|
|
@@ -61684,6 +61739,7 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
61684
61739
|
const remoteVersion = parseVersion(version2);
|
|
61685
61740
|
const localParsedVersion = parseVersion(localVersion);
|
|
61686
61741
|
if (localParsedVersion.major !== remoteVersion.major) {
|
|
61742
|
+
this._logger.error("Major version mismatch", { local: localParsedVersion, remote: remoteVersion });
|
|
61687
61743
|
return {
|
|
61688
61744
|
status: "error",
|
|
61689
61745
|
error: "compatibility",
|
|
@@ -61692,6 +61748,7 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
61692
61748
|
serverVersion: version2
|
|
61693
61749
|
};
|
|
61694
61750
|
}
|
|
61751
|
+
this._logger.log("API version check passed", { local: localParsedVersion, remote: remoteVersion });
|
|
61695
61752
|
return void 0;
|
|
61696
61753
|
}
|
|
61697
61754
|
/**
|
|
@@ -61710,8 +61767,8 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
61710
61767
|
* @param url - The server URL to connect to. Defaults to 'ws://localhost:8123'.
|
|
61711
61768
|
* @returns A promise that resolves when the connection is established.
|
|
61712
61769
|
*/
|
|
61713
|
-
async connect(
|
|
61714
|
-
await this._socketClient.connect(
|
|
61770
|
+
async connect(settings2) {
|
|
61771
|
+
await this._socketClient.connect(settings2);
|
|
61715
61772
|
}
|
|
61716
61773
|
/**
|
|
61717
61774
|
* Disconnects from the current VIM Ultra server.
|
|
@@ -61721,16 +61778,16 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
61721
61778
|
}
|
|
61722
61779
|
/**
|
|
61723
61780
|
* Requests the server to load the given URL or file path.
|
|
61724
|
-
* @param
|
|
61781
|
+
* @param source - The path or URL to the VIM file.
|
|
61725
61782
|
* @returns A load request object that can be used to wait for the load to complete.
|
|
61726
61783
|
*/
|
|
61727
|
-
loadVim(
|
|
61728
|
-
if (typeof
|
|
61784
|
+
loadVim(source) {
|
|
61785
|
+
if (typeof source.url !== "string" || source.url.trim() === "") {
|
|
61729
61786
|
const request22 = new LoadRequest$1();
|
|
61730
61787
|
request22.error("loadingError", "Invalid path");
|
|
61731
61788
|
return request22;
|
|
61732
61789
|
}
|
|
61733
|
-
const vim = new Vim(this.rpc, this.colors,
|
|
61790
|
+
const vim = new Vim(this.rpc, this.colors, source, this._logger);
|
|
61734
61791
|
this._vims.add(vim);
|
|
61735
61792
|
const request2 = vim.connect();
|
|
61736
61793
|
request2.getResult().then((result) => {
|
|
@@ -61774,7 +61831,6 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
61774
61831
|
__proto__: null,
|
|
61775
61832
|
Box3,
|
|
61776
61833
|
ColorHandle,
|
|
61777
|
-
DEFAULT_LOCAL_ULTRA_SERVER_URL,
|
|
61778
61834
|
INVALID_HANDLE,
|
|
61779
61835
|
Matrix44: Matrix4,
|
|
61780
61836
|
RGB,
|
|
@@ -74215,6 +74271,8 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
74215
74271
|
relay("pointerdown", (s, e) => new PointerEvent(s, e), false);
|
|
74216
74272
|
relay("pointermove", (s, e) => new PointerEvent(s, e), false);
|
|
74217
74273
|
relay("pointerup", (s, e) => new PointerEvent(s, e), false);
|
|
74274
|
+
relay("pointerenter", (s, e) => new PointerEvent(s, e));
|
|
74275
|
+
relay("pointerleave", (s, e) => new PointerEvent(s, e));
|
|
74218
74276
|
relay("touchstart", (s, e) => new TouchEvent(s, e), false);
|
|
74219
74277
|
relay("touchend", (s, e) => new TouchEvent(s, e), false);
|
|
74220
74278
|
relay("touchmove", (s, e) => new TouchEvent(s, e), false);
|
|
@@ -75658,18 +75716,18 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
75658
75716
|
}
|
|
75659
75717
|
return true;
|
|
75660
75718
|
}
|
|
75661
|
-
function serverFileDownloadingError(url, server) {
|
|
75719
|
+
function serverFileDownloadingError(url, authToken, server) {
|
|
75662
75720
|
if (isFilePathOrUri(url)) {
|
|
75663
75721
|
return fileOpeningError(url);
|
|
75664
75722
|
}
|
|
75665
75723
|
return {
|
|
75666
75724
|
title: "File Downloading Error",
|
|
75667
|
-
body: body$4(server,
|
|
75725
|
+
body: body$4(server, authToken, server),
|
|
75668
75726
|
footer: footer(support),
|
|
75669
75727
|
canClose: false
|
|
75670
75728
|
};
|
|
75671
75729
|
}
|
|
75672
|
-
function body$4(server,
|
|
75730
|
+
function body$4(url, server, authToken) {
|
|
75673
75731
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: vcRoboto, children: [
|
|
75674
75732
|
mainText(/* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
75675
75733
|
"Oops, it appears that there’s an ",
|
|
@@ -75679,7 +75737,8 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
75679
75737
|
subTitle("Error details:"),
|
|
75680
75738
|
dotList([
|
|
75681
75739
|
server ? bullet("VIM ULTRA Server:", server) : null,
|
|
75682
|
-
bullet("File URL:", url)
|
|
75740
|
+
bullet("File URL:", url),
|
|
75741
|
+
authToken ? bullet("Auth Token:", authToken) : null
|
|
75683
75742
|
]),
|
|
75684
75743
|
subTitle("Troubleshooting tips:"),
|
|
75685
75744
|
numList([
|
|
@@ -75815,17 +75874,17 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
75815
75874
|
return serverStreamError(state.serverUrl);
|
|
75816
75875
|
}
|
|
75817
75876
|
}
|
|
75818
|
-
function getRequestErrorMessage(
|
|
75877
|
+
function getRequestErrorMessage(source, error) {
|
|
75819
75878
|
console.log(error);
|
|
75820
75879
|
switch (error) {
|
|
75821
75880
|
case "loadingError":
|
|
75822
|
-
return serverFileLoadingError(url);
|
|
75881
|
+
return serverFileLoadingError(source.url);
|
|
75823
75882
|
case "downloadingError":
|
|
75824
75883
|
case "unknown":
|
|
75825
75884
|
case "cancelled":
|
|
75826
|
-
return serverFileDownloadingError(url);
|
|
75885
|
+
return serverFileDownloadingError(source.url);
|
|
75827
75886
|
case "serverDisconnected":
|
|
75828
|
-
return serverConnectionError(url);
|
|
75887
|
+
return serverConnectionError(source.url);
|
|
75829
75888
|
}
|
|
75830
75889
|
}
|
|
75831
75890
|
function createUltraComponent(container) {
|
|
@@ -75880,13 +75939,13 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
75880
75939
|
}
|
|
75881
75940
|
}
|
|
75882
75941
|
function ToRef(viewer, modal) {
|
|
75883
|
-
function load(
|
|
75884
|
-
const request2 = viewer.loadVim(
|
|
75942
|
+
function load(source) {
|
|
75943
|
+
const request2 = viewer.loadVim(source);
|
|
75885
75944
|
void updateProgress(request2, modal);
|
|
75886
75945
|
void request2.getResult().then(
|
|
75887
75946
|
(result) => {
|
|
75888
75947
|
if (result.isError) {
|
|
75889
|
-
modal.message(getRequestErrorMessage(
|
|
75948
|
+
modal.message(getRequestErrorMessage(source, result.error));
|
|
75890
75949
|
return;
|
|
75891
75950
|
}
|
|
75892
75951
|
if (result.isSuccess) {
|