@mml-io/3d-web-client-core 0.0.0-experimental-2ed8f19-20241118 → 0.0.0-experimental-19bc481-20241121

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.d.ts CHANGED
@@ -14,6 +14,6 @@ export { TimeManager } from "./time/TimeManager";
14
14
  export { CollisionsManager } from "./collisions/CollisionsManager";
15
15
  export { Sun } from "./sun/Sun";
16
16
  export { GroundPlane } from "./ground-plane/GroundPlane";
17
- export { LoadingScreen } from "./loading-screen/LoadingScreen";
17
+ export { LoadingScreenConfig, LoadingScreen } from "./loading-screen/LoadingScreen";
18
18
  export { ErrorScreen } from "./error-screen/ErrorScreen";
19
19
  export { EnvironmentConfiguration } from "./rendering/composer";
package/build/index.js CHANGED
@@ -5914,57 +5914,132 @@ var GroundPlane = class extends Group6 {
5914
5914
  // src/loading-screen/LoadingScreen.ts
5915
5915
  import { LoadingProgressManager as LoadingProgressManager2 } from "mml-web";
5916
5916
  var LoadingScreen = class {
5917
- constructor(loadingProgressManager) {
5917
+ constructor(loadingProgressManager, config) {
5918
5918
  this.loadingProgressManager = loadingProgressManager;
5919
+ this.config = config;
5920
+ this.overlayLayers = [];
5919
5921
  this.hasCompleted = false;
5920
5922
  this.disposed = false;
5923
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
5924
+ const defaultBackground = "linear-gradient(45deg, #28284B 0%, #303056 100%)";
5921
5925
  this.element = document.createElement("div");
5926
+ this.element.id = "loading-screen";
5922
5927
  this.element.style.position = "absolute";
5923
5928
  this.element.style.top = "0";
5924
5929
  this.element.style.left = "0";
5925
5930
  this.element.style.width = "100%";
5926
5931
  this.element.style.height = "100%";
5927
- this.element.style.background = "linear-gradient(45deg, #28284B 0%, #303056 100%)";
5928
- this.element.style.color = "white";
5929
- this.element.addEventListener("click", (event) => {
5930
- event.stopPropagation();
5931
- });
5932
- this.element.addEventListener("mousedown", (event) => {
5933
- event.stopPropagation();
5934
- });
5935
- this.element.addEventListener("mousemove", (event) => {
5936
- event.stopPropagation();
5937
- });
5938
- this.element.addEventListener("mouseup", (event) => {
5939
- event.stopPropagation();
5940
- });
5941
- this.loadingBannerText = document.createElement("div");
5942
- this.loadingBannerText.textContent = "Loading...";
5943
- this.loadingBannerText.style.position = "absolute";
5944
- this.loadingBannerText.style.display = "flex";
5945
- this.loadingBannerText.style.top = "0";
5946
- this.loadingBannerText.style.left = "0";
5947
- this.loadingBannerText.style.width = "100%";
5948
- this.loadingBannerText.style.height = "100%";
5949
- this.loadingBannerText.style.color = "white";
5950
- this.loadingBannerText.style.fontSize = "80px";
5951
- this.loadingBannerText.style.fontWeight = "bold";
5952
- this.loadingBannerText.style.fontFamily = "sans-serif";
5953
- this.loadingBannerText.style.alignItems = "center";
5954
- this.loadingBannerText.style.justifyContent = "center";
5955
- this.element.append(this.loadingBannerText);
5932
+ this.element.style.backgroundColor = ((_a = this.config) == null ? void 0 : _a.background) || defaultBackground;
5933
+ this.element.style.background = ((_b = this.config) == null ? void 0 : _b.background) || defaultBackground;
5934
+ this.element.style.zIndex = "10001";
5935
+ this.backgroundBlur = document.createElement("div");
5936
+ this.backgroundBlur.id = "loading-screen-blur";
5937
+ this.backgroundBlur.style.position = "absolute";
5938
+ this.backgroundBlur.style.top = "0";
5939
+ this.backgroundBlur.style.left = "0";
5940
+ this.backgroundBlur.style.width = "100%";
5941
+ this.backgroundBlur.style.height = "100%";
5942
+ this.backgroundBlur.style.display = "flex";
5943
+ if ((_c = this.config) == null ? void 0 : _c.backgroundBlurAmount) {
5944
+ this.backgroundBlur.style.backdropFilter = `blur(${this.config.backgroundBlurAmount}px)`;
5945
+ }
5946
+ this.element.append(this.backgroundBlur);
5947
+ if ((_d = this.config) == null ? void 0 : _d.backgroundImageUrl) {
5948
+ this.element.style.backgroundImage = `url(${this.config.backgroundImageUrl})`;
5949
+ this.element.style.backgroundPosition = "center";
5950
+ this.element.style.backgroundSize = "cover";
5951
+ }
5952
+ if ((_e = this.config) == null ? void 0 : _e.overlayLayers) {
5953
+ const logLoadError = (imageUrl) => {
5954
+ console.error(`Failed to load overlay image: ${imageUrl}`);
5955
+ };
5956
+ for (const layer of this.config.overlayLayers) {
5957
+ const overlayLayer = document.createElement("div");
5958
+ overlayLayer.style.position = "absolute";
5959
+ overlayLayer.style.background = `url(${layer.overlayImageUrl}) no-repeat`;
5960
+ overlayLayer.style.backgroundSize = "contain";
5961
+ const anchor = layer.overlayAnchor;
5962
+ const offsetX = ((_f = layer.overlayOffset) == null ? void 0 : _f.x) || 0;
5963
+ const offsetY = ((_g = layer.overlayOffset) == null ? void 0 : _g.y) || 0;
5964
+ if (anchor.includes("top")) {
5965
+ overlayLayer.style.top = `${offsetY}px`;
5966
+ } else if (anchor.includes("bottom")) {
5967
+ overlayLayer.style.bottom = `${offsetY}px`;
5968
+ }
5969
+ if (anchor.includes("left")) {
5970
+ overlayLayer.style.left = `${offsetX}px`;
5971
+ } else if (anchor.includes("right")) {
5972
+ overlayLayer.style.right = `${offsetX}px`;
5973
+ }
5974
+ const image = new Image();
5975
+ image.src = layer.overlayImageUrl;
5976
+ image.onload = () => {
5977
+ const naturalWidth = image.naturalWidth;
5978
+ const naturalHeight = image.naturalHeight;
5979
+ overlayLayer.style.width = `${naturalWidth}px`;
5980
+ overlayLayer.style.height = `${naturalHeight}px`;
5981
+ };
5982
+ image.onerror = () => logLoadError(layer.overlayImageUrl);
5983
+ this.overlayLayers.push(overlayLayer);
5984
+ this.backgroundBlur.append(overlayLayer);
5985
+ }
5986
+ }
5987
+ this.element.style.color = ((_h = this.config) == null ? void 0 : _h.color) || "white";
5988
+ this.loadingBanner = document.createElement("div");
5989
+ this.loadingBanner.style.position = "absolute";
5990
+ this.loadingBanner.style.display = "flex";
5991
+ this.loadingBanner.style.flexDirection = "column";
5992
+ this.loadingBanner.style.left = "0";
5993
+ this.loadingBanner.style.bottom = "0";
5994
+ this.loadingBanner.style.padding = "0";
5995
+ this.loadingBanner.style.width = "100%";
5996
+ this.loadingBanner.style.justifyContent = "flex-end";
5997
+ this.backgroundBlur.append(this.loadingBanner);
5998
+ if ((_i = this.config) == null ? void 0 : _i.title) {
5999
+ this.loadingBannerTitle = document.createElement("div");
6000
+ this.loadingBannerTitle.textContent = this.config.title;
6001
+ this.loadingBannerTitle.style.color = ((_j = this.config) == null ? void 0 : _j.color) || "white";
6002
+ this.loadingBannerTitle.style.paddingLeft = "40px";
6003
+ this.loadingBannerTitle.style.paddingRight = "40px";
6004
+ this.loadingBannerTitle.style.fontSize = "42px";
6005
+ this.loadingBannerTitle.style.fontWeight = "bold";
6006
+ this.loadingBannerTitle.style.fontFamily = "sans-serif";
6007
+ if ((_k = this.config) == null ? void 0 : _k.background) {
6008
+ this.loadingBannerTitle.style.textShadow = `0px 0px 80px ${this.config.background}`;
6009
+ }
6010
+ this.loadingBanner.append(this.loadingBannerTitle);
6011
+ }
6012
+ if ((_l = this.config) == null ? void 0 : _l.subtitle) {
6013
+ this.loadingBannerSubtitle = document.createElement("div");
6014
+ this.loadingBannerSubtitle.style.color = ((_m = this.config) == null ? void 0 : _m.color) || "white";
6015
+ this.loadingBannerSubtitle.style.paddingLeft = "40px";
6016
+ this.loadingBannerSubtitle.style.paddingRight = "40px";
6017
+ this.loadingBannerSubtitle.style.fontSize = "16px";
6018
+ this.loadingBannerSubtitle.style.fontWeight = "400";
6019
+ this.loadingBannerSubtitle.style.fontFamily = "sans-serif";
6020
+ this.loadingBannerSubtitle.style.marginTop = "12px";
6021
+ if ((_n = this.config) == null ? void 0 : _n.background) {
6022
+ this.loadingBannerSubtitle.style.textShadow = `0px 0px 40px ${this.config.background}`;
6023
+ }
6024
+ this.loadingBannerSubtitle.textContent = this.config.subtitle;
6025
+ this.loadingBanner.append(this.loadingBannerSubtitle);
6026
+ }
5956
6027
  this.progressDebugViewHolder = document.createElement("div");
5957
- this.progressDebugViewHolder.style.display = "flex";
6028
+ this.progressDebugViewHolder.style.display = "none";
5958
6029
  this.progressDebugViewHolder.style.position = "absolute";
5959
- this.progressDebugViewHolder.style.maxHeight = "calc(100% - 74px)";
5960
- this.progressDebugViewHolder.style.left = "0";
5961
- this.progressDebugViewHolder.style.bottom = "74px";
5962
- this.progressDebugViewHolder.style.width = "100%";
6030
+ this.progressDebugViewHolder.style.width = "calc(100% - 80px)";
6031
+ this.progressDebugViewHolder.style.maxHeight = "calc(100% - 120px)";
6032
+ this.progressDebugViewHolder.style.left = "40px";
6033
+ this.progressDebugViewHolder.style.bottom = "60px";
6034
+ this.progressDebugViewHolder.style.alignItems = "center";
5963
6035
  this.progressDebugViewHolder.style.justifyContent = "center";
6036
+ this.progressDebugViewHolder.style.zIndex = "10003";
5964
6037
  this.element.append(this.progressDebugViewHolder);
5965
6038
  this.progressDebugView = document.createElement("div");
5966
- this.progressDebugView.style.backgroundColor = "rgba(128, 128, 128, 0.25)";
6039
+ this.progressDebugView.style.backgroundColor = "rgba(128, 128, 128, 0.5)";
5967
6040
  this.progressDebugView.style.border = "1px solid black";
6041
+ this.progressDebugView.style.borderRadius = "7px";
6042
+ this.progressDebugView.style.width = "100%";
5968
6043
  this.progressDebugView.style.maxWidth = "100%";
5969
6044
  this.progressDebugView.style.overflow = "auto";
5970
6045
  this.progressDebugViewHolder.append(this.progressDebugView);
@@ -5973,6 +6048,8 @@ var LoadingScreen = class {
5973
6048
  this.debugCheckbox.checked = false;
5974
6049
  this.debugCheckbox.addEventListener("change", () => {
5975
6050
  this.progressDebugElement.style.display = this.debugCheckbox.checked ? "block" : "none";
6051
+ this.loadingBannerTitle.style.display = this.debugCheckbox.checked ? "none" : "flex";
6052
+ this.loadingBannerSubtitle.style.display = this.debugCheckbox.checked ? "none" : "flex";
5976
6053
  if (this.hasCompleted) {
5977
6054
  this.dispose();
5978
6055
  }
@@ -5991,23 +6068,36 @@ var LoadingScreen = class {
5991
6068
  this.progressDebugView.append(this.progressDebugElement);
5992
6069
  this.progressBarHolder = document.createElement("div");
5993
6070
  this.progressBarHolder.style.display = "flex";
5994
- this.progressBarHolder.style.alignItems = "center";
5995
- this.progressBarHolder.style.justifyContent = "center";
5996
- this.progressBarHolder.style.position = "absolute";
5997
- this.progressBarHolder.style.bottom = "20px";
5998
- this.progressBarHolder.style.left = "0";
6071
+ this.progressBarHolder.style.alignItems = "start";
6072
+ this.progressBarHolder.style.justifyContent = "flex-start";
5999
6073
  this.progressBarHolder.style.width = "100%";
6000
- this.element.append(this.progressBarHolder);
6074
+ this.progressBarHolder.style.marginLeft = "40px";
6075
+ this.progressBarHolder.style.marginBottom = "40px";
6076
+ this.progressBarHolder.style.cursor = "pointer";
6077
+ this.progressBarHolder.style.marginTop = "24px";
6078
+ this.loadingBanner.append(this.progressBarHolder);
6001
6079
  this.progressBarBackground = document.createElement("div");
6002
6080
  this.progressBarBackground.style.position = "relative";
6003
- this.progressBarBackground.style.width = "500px";
6004
- this.progressBarBackground.style.maxWidth = "80%";
6005
- this.progressBarBackground.style.backgroundColor = "gray";
6006
- this.progressBarBackground.style.height = "50px";
6007
- this.progressBarBackground.style.lineHeight = "50px";
6008
- this.progressBarBackground.style.borderRadius = "25px";
6009
- this.progressBarBackground.style.border = "2px solid white";
6081
+ this.progressBarBackground.style.width = "80%";
6082
+ this.progressBarBackground.style.maxWidth = "400px";
6083
+ this.progressBarBackground.style.minWidth = "240px";
6084
+ this.progressBarBackground.style.backgroundColor = "rgba(32,32,32, 0.25)";
6085
+ this.progressBarBackground.style.backdropFilter = "blur(4px)";
6086
+ this.progressBarBackground.style.height = "16px";
6087
+ this.progressBarBackground.style.lineHeight = "16px";
6088
+ this.progressBarBackground.style.borderRadius = "16px";
6010
6089
  this.progressBarBackground.style.overflow = "hidden";
6090
+ this.progressBarBackground.addEventListener("click", () => {
6091
+ const display = this.progressDebugViewHolder.style.display;
6092
+ if (display === "none") {
6093
+ this.progressDebugViewHolder.style.display = "flex";
6094
+ } else {
6095
+ this.progressDebugViewHolder.style.display = "none";
6096
+ this.debugCheckbox.checked = false;
6097
+ this.progressDebugElement.style.display = this.debugCheckbox.checked ? "block" : "none";
6098
+ this.loadingBannerTitle.style.display = this.debugCheckbox.checked ? "none" : "flex";
6099
+ }
6100
+ });
6011
6101
  this.progressBarHolder.append(this.progressBarBackground);
6012
6102
  this.progressBar = document.createElement("div");
6013
6103
  this.progressBar.style.position = "absolute";
@@ -6015,7 +6105,8 @@ var LoadingScreen = class {
6015
6105
  this.progressBar.style.left = "0";
6016
6106
  this.progressBar.style.width = "0";
6017
6107
  this.progressBar.style.height = "100%";
6018
- this.progressBar.style.backgroundColor = "#0050a4";
6108
+ this.progressBar.style.pointerEvents = "none";
6109
+ this.progressBar.style.backgroundColor = ((_o = this.config) == null ? void 0 : _o.color) || "#0050a4";
6019
6110
  this.progressBarBackground.append(this.progressBar);
6020
6111
  this.loadingStatusText = document.createElement("div");
6021
6112
  this.loadingStatusText.style.position = "absolute";
@@ -6023,11 +6114,14 @@ var LoadingScreen = class {
6023
6114
  this.loadingStatusText.style.left = "0";
6024
6115
  this.loadingStatusText.style.width = "100%";
6025
6116
  this.loadingStatusText.style.height = "100%";
6026
- this.loadingStatusText.style.color = "white";
6117
+ this.loadingStatusText.style.color = "rgba(200,200,200,0.9)";
6118
+ this.loadingStatusText.style.fontSize = "10px";
6027
6119
  this.loadingStatusText.style.textAlign = "center";
6028
6120
  this.loadingStatusText.style.verticalAlign = "middle";
6121
+ this.loadingStatusText.style.mixBlendMode = "difference";
6029
6122
  this.loadingStatusText.style.fontFamily = "sans-serif";
6030
6123
  this.loadingStatusText.style.fontWeight = "bold";
6124
+ this.loadingStatusText.style.userSelect = "none";
6031
6125
  this.loadingStatusText.textContent = "Loading...";
6032
6126
  this.progressBarBackground.append(this.loadingStatusText);
6033
6127
  this.loadingCallback = () => {
@@ -6042,7 +6136,7 @@ var LoadingScreen = class {
6042
6136
  this.loadingStatusText.textContent = "Completed";
6043
6137
  this.progressBar.style.width = "100%";
6044
6138
  } else {
6045
- this.loadingStatusText.textContent = `Loading... ${(loadingRatio * 100).toFixed(2)}%`;
6139
+ this.loadingStatusText.textContent = `${(loadingRatio * 100).toFixed(2)}%`;
6046
6140
  this.progressBar.style.width = `${loadingRatio * 100}%`;
6047
6141
  }
6048
6142
  this.progressDebugElement.textContent = LoadingProgressManager2.LoadingProgressSummaryToString(