@mml-io/mml-web-client 0.0.0-experimental-b4e2011-20250528 → 0.0.0-experimental-f04d840-20250612
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/build/index.js +105 -7
- package/build/index.js.map +3 -3
- package/package.json +5 -5
package/build/index.js
CHANGED
|
@@ -5158,6 +5158,7 @@
|
|
|
5158
5158
|
this.loadingProgressManager = loadingProgressManager;
|
|
5159
5159
|
this.showDebugLoading = showDebugLoading;
|
|
5160
5160
|
this.hasCompleted = false;
|
|
5161
|
+
this.disposed = false;
|
|
5161
5162
|
this.element = document.createElement("div");
|
|
5162
5163
|
this.element.addEventListener("click", (event) => {
|
|
5163
5164
|
event.stopPropagation();
|
|
@@ -5254,6 +5255,61 @@
|
|
|
5254
5255
|
this.loadingProgressManager.addProgressCallback(this.loadingCallback);
|
|
5255
5256
|
}
|
|
5256
5257
|
dispose() {
|
|
5258
|
+
if (this.disposed) {
|
|
5259
|
+
return;
|
|
5260
|
+
}
|
|
5261
|
+
this.disposed = true;
|
|
5262
|
+
this.loadingProgressManager.removeProgressCallback(this.loadingCallback);
|
|
5263
|
+
this.element.remove();
|
|
5264
|
+
}
|
|
5265
|
+
};
|
|
5266
|
+
var LoadingSpinner = class {
|
|
5267
|
+
constructor(loadingProgressManager) {
|
|
5268
|
+
this.loadingProgressManager = loadingProgressManager;
|
|
5269
|
+
this.hasCompleted = false;
|
|
5270
|
+
this.disposed = false;
|
|
5271
|
+
this.element = document.createElement("div");
|
|
5272
|
+
this.progressBarHolder = document.createElement("div");
|
|
5273
|
+
this.progressBarHolder.style.position = "absolute";
|
|
5274
|
+
this.progressBarHolder.style.top = "50%";
|
|
5275
|
+
this.progressBarHolder.style.left = "50%";
|
|
5276
|
+
this.progressBarHolder.style.transform = "translate(-50%, -50%)";
|
|
5277
|
+
this.progressBarHolder.style.width = "60px";
|
|
5278
|
+
this.progressBarHolder.style.height = "60px";
|
|
5279
|
+
this.element.append(this.progressBarHolder);
|
|
5280
|
+
this.progressBar = document.createElement("div");
|
|
5281
|
+
this.progressBar.style.position = "absolute";
|
|
5282
|
+
this.progressBar.style.top = "0";
|
|
5283
|
+
this.progressBar.style.left = "0";
|
|
5284
|
+
this.progressBar.style.width = "100%";
|
|
5285
|
+
this.progressBar.style.height = "100%";
|
|
5286
|
+
this.progressBar.style.border = "6px solid #f3f3f3";
|
|
5287
|
+
this.progressBar.style.borderTop = "6px solid rgba(0, 0, 0, 0)";
|
|
5288
|
+
this.progressBar.style.borderRadius = "50%";
|
|
5289
|
+
this.progressBarHolder.append(this.progressBar);
|
|
5290
|
+
this.progressBar.animate([{ transform: "rotate(0deg)" }, { transform: "rotate(360deg)" }], {
|
|
5291
|
+
duration: 1e3,
|
|
5292
|
+
iterations: Infinity
|
|
5293
|
+
});
|
|
5294
|
+
this.loadingCallback = () => {
|
|
5295
|
+
const [, completedLoading] = this.loadingProgressManager.toRatio();
|
|
5296
|
+
if (completedLoading) {
|
|
5297
|
+
if (!this.hasCompleted) {
|
|
5298
|
+
this.hasCompleted = true;
|
|
5299
|
+
this.dispose();
|
|
5300
|
+
}
|
|
5301
|
+
this.progressBar.style.display = "none";
|
|
5302
|
+
} else {
|
|
5303
|
+
this.progressBar.style.display = "block";
|
|
5304
|
+
}
|
|
5305
|
+
};
|
|
5306
|
+
this.loadingProgressManager.addProgressCallback(this.loadingCallback);
|
|
5307
|
+
}
|
|
5308
|
+
dispose() {
|
|
5309
|
+
if (this.disposed) {
|
|
5310
|
+
return;
|
|
5311
|
+
}
|
|
5312
|
+
this.disposed = true;
|
|
5257
5313
|
this.loadingProgressManager.removeProgressCallback(this.loadingCallback);
|
|
5258
5314
|
this.element.remove();
|
|
5259
5315
|
}
|
|
@@ -8176,17 +8232,33 @@
|
|
|
8176
8232
|
}
|
|
8177
8233
|
};
|
|
8178
8234
|
var FullScreenMMLScene = class extends MMLScene {
|
|
8179
|
-
constructor(
|
|
8235
|
+
constructor(options = {}) {
|
|
8180
8236
|
super(document.createElement("div"));
|
|
8237
|
+
this.options = options;
|
|
8181
8238
|
this.element = document.createElement("div");
|
|
8182
8239
|
this.element.style.width = "100%";
|
|
8183
8240
|
this.element.style.height = "100%";
|
|
8184
8241
|
this.element.style.position = "relative";
|
|
8185
|
-
this.showDebugLoading = showDebugLoading;
|
|
8242
|
+
this.showDebugLoading = options.showDebugLoading || true;
|
|
8243
|
+
this.createLoadingProgressBar();
|
|
8244
|
+
this.configureWindowStyling();
|
|
8245
|
+
}
|
|
8246
|
+
createLoadingProgressBar() {
|
|
8186
8247
|
const loadingProgressManager = this.getLoadingProgressManager();
|
|
8187
|
-
|
|
8248
|
+
const loadingStyle = this.options.loadingStyle || "bar";
|
|
8249
|
+
if (loadingStyle === "spinner") {
|
|
8250
|
+
this.loadingProgressBar = new LoadingSpinner(loadingProgressManager);
|
|
8251
|
+
} else {
|
|
8252
|
+
this.loadingProgressBar = new LoadingProgressBar(
|
|
8253
|
+
loadingProgressManager,
|
|
8254
|
+
this.showDebugLoading
|
|
8255
|
+
);
|
|
8256
|
+
}
|
|
8188
8257
|
this.element.append(this.loadingProgressBar.element);
|
|
8189
|
-
|
|
8258
|
+
}
|
|
8259
|
+
resetLoadingProgressBar() {
|
|
8260
|
+
this.loadingProgressBar.dispose();
|
|
8261
|
+
this.createLoadingProgressBar();
|
|
8190
8262
|
}
|
|
8191
8263
|
configureWindowStyling() {
|
|
8192
8264
|
document.documentElement.style.width = "100%";
|
|
@@ -66504,7 +66576,11 @@ ${DracoWorker.toString()}
|
|
|
66504
66576
|
clearColor: new Color(1, 1, 1, 1)
|
|
66505
66577
|
});
|
|
66506
66578
|
this.camera.setPosition(0, 5, 10);
|
|
66507
|
-
this.
|
|
66579
|
+
this.contentRoot = new Entity("contentRoot", this.playcanvasApp);
|
|
66580
|
+
this.contentRoot.addChild(this.camera);
|
|
66581
|
+
if (this.options.autoConnectRoot === void 0 || this.options.autoConnectRoot) {
|
|
66582
|
+
this.playcanvasApp.root.addChild(this.contentRoot);
|
|
66583
|
+
}
|
|
66508
66584
|
this.setControlsType(this.options.controlsType);
|
|
66509
66585
|
this.clickTrigger = PlayCanvasClickTrigger.init(this.playcanvasApp, this.element, this.camera);
|
|
66510
66586
|
this.playcanvasApp.on("update", (delta) => {
|
|
@@ -66575,8 +66651,18 @@ ${DracoWorker.toString()}
|
|
|
66575
66651
|
}
|
|
66576
66652
|
this.clickTrigger.dispose();
|
|
66577
66653
|
}
|
|
66654
|
+
disconnectRoot() {
|
|
66655
|
+
if (this.contentRoot.parent) {
|
|
66656
|
+
this.contentRoot.parent.removeChild(this.contentRoot);
|
|
66657
|
+
}
|
|
66658
|
+
}
|
|
66659
|
+
connectRoot() {
|
|
66660
|
+
if (!this.contentRoot.parent) {
|
|
66661
|
+
this.playcanvasApp.root.addChild(this.contentRoot);
|
|
66662
|
+
}
|
|
66663
|
+
}
|
|
66578
66664
|
getRootContainer() {
|
|
66579
|
-
return this.
|
|
66665
|
+
return this.contentRoot;
|
|
66580
66666
|
}
|
|
66581
66667
|
getBoundingBoxForElement(element) {
|
|
66582
66668
|
if (!TransformableElement.isTransformableElement(element)) {
|
|
@@ -99344,7 +99430,9 @@ void main() {
|
|
|
99344
99430
|
return new Promise((resolve) => {
|
|
99345
99431
|
this.rootContainer = new Group2();
|
|
99346
99432
|
this.threeScene = new Scene2();
|
|
99347
|
-
this.
|
|
99433
|
+
if (this.options.autoConnectRoot === void 0 || this.options.autoConnectRoot) {
|
|
99434
|
+
this.threeScene.add(this.rootContainer);
|
|
99435
|
+
}
|
|
99348
99436
|
this.camera = new PerspectiveCamera(
|
|
99349
99437
|
75,
|
|
99350
99438
|
window.innerWidth / window.innerHeight,
|
|
@@ -99418,6 +99506,16 @@ void main() {
|
|
|
99418
99506
|
renderer.domElement.style.pointerEvents = "none";
|
|
99419
99507
|
return renderer;
|
|
99420
99508
|
}
|
|
99509
|
+
disconnectRoot() {
|
|
99510
|
+
if (this.rootContainer.parent) {
|
|
99511
|
+
this.rootContainer.parent.remove(this.rootContainer);
|
|
99512
|
+
}
|
|
99513
|
+
}
|
|
99514
|
+
connectRoot() {
|
|
99515
|
+
if (!this.rootContainer.parent) {
|
|
99516
|
+
this.threeScene.add(this.rootContainer);
|
|
99517
|
+
}
|
|
99518
|
+
}
|
|
99421
99519
|
start() {
|
|
99422
99520
|
this.animationFrameRequest = requestAnimationFrame(this.animationFrameCallback);
|
|
99423
99521
|
}
|