@mml-io/3d-web-client-core 0.0.0-experimental-5a49f55-20240611 → 0.0.0-experimental-0c0b0b6-20240620

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,7 @@
1
+ export declare class ErrorScreen {
2
+ readonly element: HTMLDivElement;
3
+ private titleBannerText;
4
+ private messageText;
5
+ constructor(title: string, message: string);
6
+ dispose(): void;
7
+ }
package/build/index.d.ts CHANGED
@@ -15,4 +15,5 @@ export { CollisionsManager } from "./collisions/CollisionsManager";
15
15
  export { Sun } from "./sun/Sun";
16
16
  export { GroundPlane } from "./ground-plane/GroundPlane";
17
17
  export { LoadingScreen } from "./loading-screen/LoadingScreen";
18
+ export { ErrorScreen } from "./error-screen/ErrorScreen";
18
19
  export { EnvironmentConfiguration } from "./rendering/composer";
package/build/index.js CHANGED
@@ -481,8 +481,9 @@ var CameraManager = class {
481
481
  }
482
482
  }
483
483
  onMouseMove(event) {
484
- if (getTweakpaneActive())
484
+ if (getTweakpaneActive()) {
485
485
  return;
486
+ }
486
487
  if (this.dragging) {
487
488
  if (this.targetTheta === null || this.targetPhi === null)
488
489
  return;
@@ -493,6 +494,9 @@ var CameraManager = class {
493
494
  }
494
495
  }
495
496
  onMouseWheel(event) {
497
+ if (getTweakpaneActive()) {
498
+ return;
499
+ }
496
500
  const scrollAmount = event.deltaY * this.zoomScale * 0.1;
497
501
  this.targetDistance += scrollAmount;
498
502
  this.targetDistance = Math.max(
@@ -3323,9 +3327,6 @@ var tweakPaneStyle = `
3323
3327
  --tp-label-foreground-color: hsla(0, 0%, 100%, 0.6);
3324
3328
  --tp-monitor-background-color: hsla(0, 0%, 0%, 0.3);
3325
3329
  --tp-monitor-foreground-color: hsla(0, 0%, 100%, 0.3);
3326
- -webkit-user-select: none;
3327
- -ms-user-select: none;
3328
- user-select: none;
3329
3330
  }
3330
3331
 
3331
3332
  .tp-brkv {
@@ -3394,20 +3395,20 @@ var TweakPane = class {
3394
3395
  this.composer = composer;
3395
3396
  this.saveVisibilityInLocalStorage = true;
3396
3397
  this.guiVisible = false;
3397
- const tweakPaneWrapper = document.createElement("div");
3398
- tweakPaneWrapper.style.position = "fixed";
3399
- tweakPaneWrapper.style.width = "400px";
3400
- tweakPaneWrapper.style.height = "100%";
3401
- tweakPaneWrapper.style.top = "0px";
3402
- tweakPaneWrapper.style.right = "calc(-50vw)";
3403
- tweakPaneWrapper.style.zIndex = "99";
3404
- tweakPaneWrapper.style.overflow = "auto";
3405
- tweakPaneWrapper.style.backgroundColor = "rgba(0, 0, 0, 0.66)";
3406
- tweakPaneWrapper.style.paddingLeft = "5px";
3407
- tweakPaneWrapper.style.boxShadow = "-7px 0px 12px rgba(0, 0, 0, 0.5)";
3408
- tweakPaneWrapper.style.transition = "right cubic-bezier(0.83, 0, 0.17, 1) 0.7s";
3409
- holderElement.appendChild(tweakPaneWrapper);
3410
- this.gui = new Pane({ container: tweakPaneWrapper });
3398
+ this.tweakPaneWrapper = document.createElement("div");
3399
+ this.tweakPaneWrapper.style.position = "fixed";
3400
+ this.tweakPaneWrapper.style.width = "400px";
3401
+ this.tweakPaneWrapper.style.height = "100%";
3402
+ this.tweakPaneWrapper.style.top = "0px";
3403
+ this.tweakPaneWrapper.style.right = "calc(-50vw)";
3404
+ this.tweakPaneWrapper.style.zIndex = "99";
3405
+ this.tweakPaneWrapper.style.overflow = "auto";
3406
+ this.tweakPaneWrapper.style.backgroundColor = "rgba(0, 0, 0, 0.66)";
3407
+ this.tweakPaneWrapper.style.paddingLeft = "5px";
3408
+ this.tweakPaneWrapper.style.boxShadow = "-7px 0px 12px rgba(0, 0, 0, 0.5)";
3409
+ this.tweakPaneWrapper.style.transition = "right cubic-bezier(0.83, 0, 0.17, 1) 0.7s";
3410
+ holderElement.appendChild(this.tweakPaneWrapper);
3411
+ this.gui = new Pane({ container: this.tweakPaneWrapper });
3411
3412
  this.gui.registerPlugin(EssentialsPlugin);
3412
3413
  if (this.saveVisibilityInLocalStorage) {
3413
3414
  const localStorageGuiVisible = localStorage.getItem("guiVisible");
@@ -3435,19 +3436,20 @@ var TweakPane = class {
3435
3436
  this.characterControls = new CharacterControlsFolder(this.gui, false);
3436
3437
  this.toneMappingFolder.folder.hidden = rendererValues.toneMapping === 5 ? false : true;
3437
3438
  this.export = this.gui.addFolder({ title: "import / export", expanded: false });
3439
+ this.setupGUIListeners();
3438
3440
  window.addEventListener("keydown", (e) => {
3439
3441
  this.processKey(e);
3440
3442
  });
3441
- this.setupGUIListeners();
3442
3443
  }
3443
3444
  setupGUIListeners() {
3444
3445
  const gui = this.gui;
3445
3446
  const paneElement = gui.containerElem_;
3446
3447
  paneElement.style.right = this.guiVisible ? "0px" : "-450px";
3447
3448
  this.gui.element.addEventListener("mouseenter", () => setTweakpaneActive(true));
3449
+ this.gui.element.addEventListener("mousemove", () => setTweakpaneActive(true));
3448
3450
  this.gui.element.addEventListener("mousedown", () => setTweakpaneActive(true));
3449
- this.gui.element.addEventListener("mouseup", () => setTweakpaneActive(false));
3450
3451
  this.gui.element.addEventListener("mouseleave", () => setTweakpaneActive(false));
3452
+ this.gui.element.addEventListener("mouseup", () => setTweakpaneActive(false));
3451
3453
  }
3452
3454
  processKey(e) {
3453
3455
  if (e.key === "p")
@@ -3484,6 +3486,10 @@ var TweakPane = class {
3484
3486
  });
3485
3487
  });
3486
3488
  }
3489
+ dispose() {
3490
+ this.gui.dispose();
3491
+ this.tweakPaneWrapper.remove();
3492
+ }
3487
3493
  setupCamPane(cameraManager) {
3488
3494
  this.camera.setupChangeEvent(cameraManager);
3489
3495
  }
@@ -5292,6 +5298,7 @@ var Composer = class {
5292
5298
  }
5293
5299
  dispose() {
5294
5300
  window.removeEventListener("resize", this.resizeListener);
5301
+ this.renderer.dispose();
5295
5302
  }
5296
5303
  fitContainer() {
5297
5304
  if (!this) {
@@ -5856,6 +5863,7 @@ var LoadingScreen = class {
5856
5863
  constructor(loadingProgressManager) {
5857
5864
  this.loadingProgressManager = loadingProgressManager;
5858
5865
  this.hasCompleted = false;
5866
+ this.disposed = false;
5859
5867
  this.element = document.createElement("div");
5860
5868
  this.element.style.position = "absolute";
5861
5869
  this.element.style.top = "0";
@@ -5990,10 +5998,47 @@ var LoadingScreen = class {
5990
5998
  this.loadingProgressManager.addProgressCallback(this.loadingCallback);
5991
5999
  }
5992
6000
  dispose() {
6001
+ if (this.disposed) {
6002
+ return;
6003
+ }
6004
+ this.disposed = true;
5993
6005
  this.loadingProgressManager.removeProgressCallback(this.loadingCallback);
5994
6006
  this.element.remove();
5995
6007
  }
5996
6008
  };
6009
+
6010
+ // src/error-screen/ErrorScreen.ts
6011
+ var ErrorScreen = class {
6012
+ constructor(title, message) {
6013
+ this.element = document.createElement("div");
6014
+ this.element.style.position = "absolute";
6015
+ this.element.style.top = "0";
6016
+ this.element.style.left = "0";
6017
+ this.element.style.display = "flex";
6018
+ this.element.style.alignItems = "center";
6019
+ this.element.style.justifyContent = "center";
6020
+ this.element.style.flexDirection = "column";
6021
+ this.element.style.width = "100%";
6022
+ this.element.style.height = "100%";
6023
+ this.element.style.background = "linear-gradient(45deg, #111111 0%, #444444 100%)";
6024
+ this.element.style.color = "white";
6025
+ this.titleBannerText = document.createElement("div");
6026
+ this.titleBannerText.textContent = title;
6027
+ this.titleBannerText.style.fontSize = "40px";
6028
+ this.titleBannerText.style.fontWeight = "bold";
6029
+ this.titleBannerText.style.fontFamily = "sans-serif";
6030
+ this.element.append(this.titleBannerText);
6031
+ this.messageText = document.createElement("div");
6032
+ this.messageText.style.textAlign = "center";
6033
+ this.messageText.style.fontFamily = "sans-serif";
6034
+ this.messageText.style.fontWeight = "bold";
6035
+ this.messageText.textContent = message;
6036
+ this.element.append(this.messageText);
6037
+ }
6038
+ dispose() {
6039
+ this.element.remove();
6040
+ }
6041
+ };
5997
6042
  export {
5998
6043
  AnimationState,
5999
6044
  CameraManager,
@@ -6001,6 +6046,7 @@ export {
6001
6046
  CharacterModelLoader,
6002
6047
  CollisionsManager,
6003
6048
  Composer,
6049
+ ErrorScreen,
6004
6050
  GroundPlane,
6005
6051
  KeyInputManager,
6006
6052
  LoadingScreen,