@netless/window-manager 1.0.13-test.17 → 1.0.13-test.19
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/index.d.ts +2 -7
- package/dist/index.js +13 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +55 -165
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/AppManager.ts +10 -10
- package/src/AttributesDelegate.ts +5 -5
- package/src/BoxManager.ts +0 -1
- package/src/ContainerResizeObserver.ts +4 -5
- package/src/Utils/Common.ts +0 -1
- package/src/Utils/RoomHacker.ts +15 -1
- package/src/View/MainView.ts +17 -148
- package/src/index.ts +5 -5
package/dist/index.mjs
CHANGED
|
@@ -352,7 +352,6 @@ const setScenePath = (room, scenePath) => {
|
|
|
352
352
|
if (room && room.isWritable) {
|
|
353
353
|
if (room.state.sceneState.scenePath !== scenePath) {
|
|
354
354
|
const nextScenePath = scenePath === "/" ? "" : scenePath;
|
|
355
|
-
console.log("[window-manager] real setScenePath for current room ", nextScenePath);
|
|
356
355
|
room.setScenePath(nextScenePath);
|
|
357
356
|
}
|
|
358
357
|
}
|
|
@@ -5626,7 +5625,6 @@ class BoxManager {
|
|
|
5626
5625
|
const rect = (_a = this.mainView.divElement) == null ? void 0 : _a.getBoundingClientRect();
|
|
5627
5626
|
if (rect && rect.width > 0 && rect.height > 0) {
|
|
5628
5627
|
const containerRect = { x: 0, y: 0, width: rect.width, height: rect.height };
|
|
5629
|
-
console.log("[window-manager] updateManagerRect" + JSON.stringify(containerRect) + "mainView" + this.mainView.size);
|
|
5630
5628
|
this.teleBoxManager.setContainerRect(containerRect);
|
|
5631
5629
|
this.context.notifyContainerRectUpdate(this.teleBoxManager.containerRect);
|
|
5632
5630
|
}
|
|
@@ -7034,7 +7032,7 @@ var Fields = /* @__PURE__ */ ((Fields2) => {
|
|
|
7034
7032
|
class AttributesDelegate {
|
|
7035
7033
|
constructor(context) {
|
|
7036
7034
|
this.context = context;
|
|
7037
|
-
this.setMainViewCameraConsole = new LocalConsole("setMainViewCamera",
|
|
7035
|
+
this.setMainViewCameraConsole = new LocalConsole("setMainViewCamera", 30);
|
|
7038
7036
|
this.setAppFocus = (appId, focus) => {
|
|
7039
7037
|
if (focus) {
|
|
7040
7038
|
this.context.safeSetAttributes({ ["focus"]: appId });
|
|
@@ -7160,11 +7158,11 @@ class AttributesDelegate {
|
|
|
7160
7158
|
return this.attributes["boxState"];
|
|
7161
7159
|
}
|
|
7162
7160
|
setMainViewScenePath(scenePath) {
|
|
7163
|
-
console.log("[window-manager] setMainViewScenePath "
|
|
7161
|
+
console.log("[window-manager] setMainViewScenePath " + scenePath);
|
|
7164
7162
|
this.context.safeSetAttributes({ _mainScenePath: scenePath });
|
|
7165
7163
|
}
|
|
7166
7164
|
setMainViewSceneIndex(index2) {
|
|
7167
|
-
console.log("[window-manager] setMainViewSceneIndex "
|
|
7165
|
+
console.log("[window-manager] setMainViewSceneIndex " + index2);
|
|
7168
7166
|
this.context.safeSetAttributes({ _mainSceneIndex: index2 });
|
|
7169
7167
|
}
|
|
7170
7168
|
getMainViewCamera() {
|
|
@@ -7180,13 +7178,13 @@ class AttributesDelegate {
|
|
|
7180
7178
|
setMainViewSize(size2) {
|
|
7181
7179
|
if (size2.width === 0 || size2.height === 0)
|
|
7182
7180
|
return;
|
|
7183
|
-
console.log("[window-manager] setMainViewSize
|
|
7181
|
+
console.log("[window-manager] setMainViewSize size:" + JSON.stringify(size2));
|
|
7184
7182
|
this.context.safeSetAttributes({ ["mainViewSize"]: { ...size2 } });
|
|
7185
7183
|
}
|
|
7186
7184
|
setMainViewCameraAndSize(camera, size2) {
|
|
7187
7185
|
if (size2.width === 0 || size2.height === 0)
|
|
7188
7186
|
return;
|
|
7189
|
-
console.log("[window-manager] setMainViewCameraAndSize
|
|
7187
|
+
console.log("[window-manager] setMainViewCameraAndSize camera:" + JSON.stringify(camera) + ", size:" + JSON.stringify(size2));
|
|
7190
7188
|
this.context.safeSetAttributes({
|
|
7191
7189
|
["mainViewCamera"]: { ...camera },
|
|
7192
7190
|
["mainViewSize"]: { ...size2 }
|
|
@@ -7797,6 +7795,8 @@ class MainViewProxy {
|
|
|
7797
7795
|
this.viewMode = this.manager.windowManger.viewMode;
|
|
7798
7796
|
this.sideEffectManager = new o$2();
|
|
7799
7797
|
this.playgroundSizeChangeListenerLocalConsole = new LocalConsole("playgroundSizeChangeListener", 30);
|
|
7798
|
+
this.sizeUpdatedLocalConsole = new LocalConsole("sizeUpdated", 30);
|
|
7799
|
+
this.cameraUpdatedLocalConsole = new LocalConsole("cameraUpdated", 30);
|
|
7800
7800
|
this.syncCamera = () => {
|
|
7801
7801
|
if (!this.polling || this.viewMode !== ViewMode.Broadcaster)
|
|
7802
7802
|
return;
|
|
@@ -7818,10 +7818,6 @@ class MainViewProxy {
|
|
|
7818
7818
|
};
|
|
7819
7819
|
this.onWrapperRectChange = (payload) => {
|
|
7820
7820
|
this.pendingWrapperRectChange = payload;
|
|
7821
|
-
console.log("[window-manager] onWrapperRectChange " + JSON.stringify({
|
|
7822
|
-
...payload,
|
|
7823
|
-
viewSize: this.mainView.size
|
|
7824
|
-
}));
|
|
7825
7821
|
if (this.wrapperRectWorkaroundFrame) {
|
|
7826
7822
|
cancelAnimationFrame(this.wrapperRectWorkaroundFrame);
|
|
7827
7823
|
}
|
|
@@ -7838,14 +7834,6 @@ class MainViewProxy {
|
|
|
7838
7834
|
const observedSize = { width: rect.width, height: rect.height };
|
|
7839
7835
|
const wrapperMatchesDom = Math.abs(payload.width - observedSize.width) <= 0.5 && Math.abs(payload.height - observedSize.height) <= 0.5;
|
|
7840
7836
|
const viewIsStale = Math.abs(this.mainView.size.width - observedSize.width) > 0.5 || Math.abs(this.mainView.size.height - observedSize.height) > 0.5;
|
|
7841
|
-
console.log("[window-manager] runWrapperRectWorkaround " + JSON.stringify({
|
|
7842
|
-
origin: payload.origin,
|
|
7843
|
-
wrapperRect: payload,
|
|
7844
|
-
domRect: observedSize,
|
|
7845
|
-
viewSize: this.mainView.size,
|
|
7846
|
-
wrapperMatchesDom,
|
|
7847
|
-
viewIsStale
|
|
7848
|
-
}));
|
|
7849
7837
|
if (wrapperMatchesDom && viewIsStale) {
|
|
7850
7838
|
this.forceSyncMainViewDivElement(
|
|
7851
7839
|
`wrapperRectChange:${payload.origin || "unknown"}`,
|
|
@@ -7874,7 +7862,7 @@ class MainViewProxy {
|
|
|
7874
7862
|
if (size2) {
|
|
7875
7863
|
this.moveCameraToContian(size2);
|
|
7876
7864
|
this.moveCamera(this.mainViewCamera);
|
|
7877
|
-
console.log("[window-manager] sizeChangeHandler
|
|
7865
|
+
console.log("[window-manager] sizeChangeHandler current size and camera" + JSON.stringify(size2) + JSON.stringify(this.mainViewCamera) + JSON.stringify(this.mainView.camera) + JSON.stringify(this.mainView.size));
|
|
7878
7866
|
}
|
|
7879
7867
|
this.ensureMainViewSize();
|
|
7880
7868
|
}, 30);
|
|
@@ -7897,88 +7885,8 @@ class MainViewProxy {
|
|
|
7897
7885
|
this.setMainViewSize = debounce((size2) => {
|
|
7898
7886
|
this.store.setMainViewSize({ ...size2, id: this.manager.uid });
|
|
7899
7887
|
}, 50);
|
|
7900
|
-
this.onResize = (entries) => {
|
|
7901
|
-
const entry = entries[0];
|
|
7902
|
-
if (!entry)
|
|
7903
|
-
return;
|
|
7904
|
-
const target = entry.target;
|
|
7905
|
-
const child = target.children[0];
|
|
7906
|
-
const observedSize = {
|
|
7907
|
-
width: entry.contentRect.width,
|
|
7908
|
-
height: entry.contentRect.height
|
|
7909
|
-
};
|
|
7910
|
-
console.log("[window-manager] mainViewResizeObserver " + JSON.stringify({
|
|
7911
|
-
sameTarget: target === this.mainView.divElement,
|
|
7912
|
-
contentRect: {
|
|
7913
|
-
width: observedSize.width,
|
|
7914
|
-
height: observedSize.height
|
|
7915
|
-
},
|
|
7916
|
-
client: {
|
|
7917
|
-
width: target.clientWidth,
|
|
7918
|
-
height: target.clientHeight
|
|
7919
|
-
},
|
|
7920
|
-
offset: {
|
|
7921
|
-
width: target.offsetWidth,
|
|
7922
|
-
height: target.offsetHeight
|
|
7923
|
-
},
|
|
7924
|
-
rect: {
|
|
7925
|
-
width: target.getBoundingClientRect().width,
|
|
7926
|
-
height: target.getBoundingClientRect().height
|
|
7927
|
-
},
|
|
7928
|
-
childRect: child ? {
|
|
7929
|
-
width: child.getBoundingClientRect().width,
|
|
7930
|
-
height: child.getBoundingClientRect().height
|
|
7931
|
-
} : null,
|
|
7932
|
-
viewSize: this.mainView.size
|
|
7933
|
-
}));
|
|
7934
|
-
};
|
|
7935
|
-
this.onResize2 = (entries) => {
|
|
7936
|
-
const entry = entries[0];
|
|
7937
|
-
if (!entry)
|
|
7938
|
-
return;
|
|
7939
|
-
const target = entry.target;
|
|
7940
|
-
const child = target.children[0];
|
|
7941
|
-
const observedSize = {
|
|
7942
|
-
width: entry.contentRect.width,
|
|
7943
|
-
height: entry.contentRect.height
|
|
7944
|
-
};
|
|
7945
|
-
console.log("[window-manager] mainViewResizeObserver2 " + JSON.stringify({
|
|
7946
|
-
sameTarget: target === this.mainView.divElement,
|
|
7947
|
-
contentRect: {
|
|
7948
|
-
width: observedSize.width,
|
|
7949
|
-
height: observedSize.height
|
|
7950
|
-
},
|
|
7951
|
-
client: {
|
|
7952
|
-
width: target.clientWidth,
|
|
7953
|
-
height: target.clientHeight
|
|
7954
|
-
},
|
|
7955
|
-
offset: {
|
|
7956
|
-
width: target.offsetWidth,
|
|
7957
|
-
height: target.offsetHeight
|
|
7958
|
-
},
|
|
7959
|
-
rect: {
|
|
7960
|
-
width: target.getBoundingClientRect().width,
|
|
7961
|
-
height: target.getBoundingClientRect().height
|
|
7962
|
-
},
|
|
7963
|
-
childRect: child ? {
|
|
7964
|
-
width: child.getBoundingClientRect().width,
|
|
7965
|
-
height: child.getBoundingClientRect().height
|
|
7966
|
-
} : null,
|
|
7967
|
-
viewSize: this.mainView.size
|
|
7968
|
-
}));
|
|
7969
|
-
};
|
|
7970
7888
|
this._syncMainViewTimer = 0;
|
|
7971
|
-
this.handleCameraOrSizeUpdated = (
|
|
7972
|
-
console.log("[window-manager] " + source + " payload " + JSON.stringify(payload));
|
|
7973
|
-
console.log("[window-manager] " + source + " state " + JSON.stringify(this.cameraState));
|
|
7974
|
-
if (this.mainView.divElement) {
|
|
7975
|
-
const children2 = this.mainView.divElement.children;
|
|
7976
|
-
console.log("[window-manager] " + source + " rect " + JSON.stringify(this.mainView.divElement.getBoundingClientRect()));
|
|
7977
|
-
const child = children2[0];
|
|
7978
|
-
if (child) {
|
|
7979
|
-
console.log("[window-manager] " + source + " child" + JSON.stringify(child.getBoundingClientRect()));
|
|
7980
|
-
}
|
|
7981
|
-
}
|
|
7889
|
+
this.handleCameraOrSizeUpdated = () => {
|
|
7982
7890
|
callbacks$1.emit("cameraStateChange", this.cameraState);
|
|
7983
7891
|
if (this.manager.room && this.manager.room.syncMainView) {
|
|
7984
7892
|
clearTimeout(this._syncMainViewTimer);
|
|
@@ -7987,14 +7895,16 @@ class MainViewProxy {
|
|
|
7987
7895
|
this.ensureMainViewSize();
|
|
7988
7896
|
};
|
|
7989
7897
|
this.onCameraUpdated = (camera) => {
|
|
7990
|
-
this.
|
|
7898
|
+
this.cameraUpdatedLocalConsole.log(JSON.stringify(camera));
|
|
7899
|
+
this.handleCameraOrSizeUpdated();
|
|
7991
7900
|
};
|
|
7992
7901
|
this.onSizeUpdated = (size2) => {
|
|
7993
|
-
this.
|
|
7902
|
+
this.sizeUpdatedLocalConsole.log(JSON.stringify(size2));
|
|
7903
|
+
this.handleCameraOrSizeUpdated();
|
|
7994
7904
|
};
|
|
7995
7905
|
this.syncMainView = (room) => {
|
|
7996
7906
|
if (room.isWritable) {
|
|
7997
|
-
console.log("[window-manager] syncMainView
|
|
7907
|
+
console.log("[window-manager] syncMainView ");
|
|
7998
7908
|
room.syncMainView(this.mainView);
|
|
7999
7909
|
}
|
|
8000
7910
|
};
|
|
@@ -8004,7 +7914,6 @@ class MainViewProxy {
|
|
|
8004
7914
|
this.mainView = this.createMainView();
|
|
8005
7915
|
this.moveCameraSizeByAttributes();
|
|
8006
7916
|
internalEmitter.once("mainViewMounted").then(() => {
|
|
8007
|
-
this.observeMainViewDivElement();
|
|
8008
7917
|
this.addMainViewListener();
|
|
8009
7918
|
this.start();
|
|
8010
7919
|
this.ensureCameraAndSize();
|
|
@@ -8032,6 +7941,9 @@ class MainViewProxy {
|
|
|
8032
7941
|
this.sideEffectManager.add(() => {
|
|
8033
7942
|
return internalEmitter.on("containerSizeRatioUpdate", this.onUpdateContainerSizeRatio);
|
|
8034
7943
|
});
|
|
7944
|
+
this.sideEffectManager.add(() => {
|
|
7945
|
+
return internalEmitter.on("wrapperRectChange", this.onWrapperRectChange);
|
|
7946
|
+
});
|
|
8035
7947
|
this.sideEffectManager.add(() => {
|
|
8036
7948
|
return internalEmitter.on("startReconnect", () => {
|
|
8037
7949
|
if (!this.didRelease) {
|
|
@@ -8062,15 +7974,6 @@ class MainViewProxy {
|
|
|
8062
7974
|
this.moveCameraToContian(this.mainViewSize);
|
|
8063
7975
|
this.moveCamera(this.mainViewCamera);
|
|
8064
7976
|
}
|
|
8065
|
-
refreshScreenSizeIfStale() {
|
|
8066
|
-
const element2 = this.mainView.divElement;
|
|
8067
|
-
if (!element2)
|
|
8068
|
-
return;
|
|
8069
|
-
const { width, height } = element2.getBoundingClientRect();
|
|
8070
|
-
if (width <= 0 || height <= 0)
|
|
8071
|
-
return;
|
|
8072
|
-
this.forceSyncMainViewDivElement("playgroundSizeChange", { width, height }, element2);
|
|
8073
|
-
}
|
|
8074
7977
|
forceSyncMainViewDivElement(reason, observedSize, element2) {
|
|
8075
7978
|
const { width: viewWidth, height: viewHeight } = this.mainView.size;
|
|
8076
7979
|
if (Math.abs(viewWidth - observedSize.width) <= 0.5 && Math.abs(viewHeight - observedSize.height) <= 0.5) {
|
|
@@ -8105,7 +8008,7 @@ class MainViewProxy {
|
|
|
8105
8008
|
});
|
|
8106
8009
|
}
|
|
8107
8010
|
start() {
|
|
8108
|
-
console.log("[window-manager] start
|
|
8011
|
+
console.log("[window-manager] start attributes size:" + JSON.stringify(this.mainViewSize));
|
|
8109
8012
|
this.sizeChangeHandler(this.mainViewSize);
|
|
8110
8013
|
if (this.started)
|
|
8111
8014
|
return;
|
|
@@ -8114,7 +8017,10 @@ class MainViewProxy {
|
|
|
8114
8017
|
if (this.manager.room)
|
|
8115
8018
|
this.syncMainView(this.manager.room);
|
|
8116
8019
|
this.started = true;
|
|
8117
|
-
|
|
8020
|
+
if (this.mainView.focusScenePath) {
|
|
8021
|
+
this.manager.windowManger.onMainViewScenePathChangeHandler(this.mainView.focusScenePath);
|
|
8022
|
+
}
|
|
8023
|
+
console.log("[window-manager] start end mainView size:" + JSON.stringify(this.mainView.size));
|
|
8118
8024
|
}
|
|
8119
8025
|
setCameraAndSize() {
|
|
8120
8026
|
const camera = { ...this.mainView.camera, id: this.manager.uid };
|
|
@@ -8156,11 +8062,9 @@ class MainViewProxy {
|
|
|
8156
8062
|
this.mainView.release();
|
|
8157
8063
|
}
|
|
8158
8064
|
this.removeMainViewListener();
|
|
8159
|
-
this.disconnectMainViewResizeObserver();
|
|
8160
8065
|
this.mainView = this.createMainView();
|
|
8161
8066
|
this.mainView.disableCameraTransform = disableCameraTransform;
|
|
8162
8067
|
this.mainView.divElement = divElement;
|
|
8163
|
-
this.observeMainViewDivElement();
|
|
8164
8068
|
this.addMainViewListener();
|
|
8165
8069
|
this.start();
|
|
8166
8070
|
callbacks$1.emit("onMainViewRebind", this.mainView);
|
|
@@ -8198,28 +8102,6 @@ class MainViewProxy {
|
|
|
8198
8102
|
this.view.callbacks.off("onCameraUpdated", this.onCameraUpdated);
|
|
8199
8103
|
this.view.callbacks.off("onSizeUpdated", this.onSizeUpdated);
|
|
8200
8104
|
}
|
|
8201
|
-
observeMainViewDivElement() {
|
|
8202
|
-
this.disconnectMainViewResizeObserver();
|
|
8203
|
-
if (!("ResizeObserver" in window))
|
|
8204
|
-
return;
|
|
8205
|
-
if (!this.mainView.divElement)
|
|
8206
|
-
return;
|
|
8207
|
-
console.log("[window-manager] observeMainViewDivElement " + JSON.stringify({
|
|
8208
|
-
rect: this.mainView.divElement.getBoundingClientRect(),
|
|
8209
|
-
viewSize: this.mainView.size
|
|
8210
|
-
}));
|
|
8211
|
-
this.mainViewResizeObserver = new window.ResizeObserver(this.onResize);
|
|
8212
|
-
this.mainViewResizeObserver.observe(this.mainView.divElement);
|
|
8213
|
-
this.mainViewResizeObserver2 = new window.ResizeObserver(this.onResize2);
|
|
8214
|
-
this.mainViewResizeObserver2.observe(this.mainView.divElement);
|
|
8215
|
-
}
|
|
8216
|
-
disconnectMainViewResizeObserver() {
|
|
8217
|
-
var _a, _b;
|
|
8218
|
-
(_a = this.mainViewResizeObserver) == null ? void 0 : _a.disconnect();
|
|
8219
|
-
this.mainViewResizeObserver = void 0;
|
|
8220
|
-
(_b = this.mainViewResizeObserver2) == null ? void 0 : _b.disconnect();
|
|
8221
|
-
this.mainViewResizeObserver2 = void 0;
|
|
8222
|
-
}
|
|
8223
8105
|
ensureMainViewSize() {
|
|
8224
8106
|
if ((!this.mainViewSize || this.mainViewSize.width === 0 || this.mainViewSize.height === 0) && this.mainView.size.width > 0 && this.mainView.size.height > 0) {
|
|
8225
8107
|
this.setMainViewSize(this.mainView.size);
|
|
@@ -8264,7 +8146,6 @@ class MainViewProxy {
|
|
|
8264
8146
|
this.wrapperRectWorkaroundFrame = 0;
|
|
8265
8147
|
}
|
|
8266
8148
|
this.removeMainViewListener();
|
|
8267
|
-
this.disconnectMainViewResizeObserver();
|
|
8268
8149
|
this.stop();
|
|
8269
8150
|
this.sideEffectManager.flushAll();
|
|
8270
8151
|
}
|
|
@@ -8353,7 +8234,7 @@ class AppManager {
|
|
|
8353
8234
|
var _a, _b;
|
|
8354
8235
|
const { scenePath } = params;
|
|
8355
8236
|
if (scenePath === ROOT_DIR) {
|
|
8356
|
-
console.log("[window-manager] onRemoveScenes
|
|
8237
|
+
console.log("[window-manager] onRemoveScenes ROOT_DIR");
|
|
8357
8238
|
await this.onRootDirRemoved();
|
|
8358
8239
|
this.dispatchInternalEvent(Events.RootDirRemoved);
|
|
8359
8240
|
return;
|
|
@@ -8366,7 +8247,7 @@ class AppManager {
|
|
|
8366
8247
|
sceneName = (_b = this.callbacksNode) == null ? void 0 : _b.scenes[nextIndex];
|
|
8367
8248
|
}
|
|
8368
8249
|
if (sceneName) {
|
|
8369
|
-
console.log(`[window-manager] onRemoveScenes
|
|
8250
|
+
console.log(`[window-manager] onRemoveScenes setMainViewScenePath ${ROOT_DIR}${sceneName}`);
|
|
8370
8251
|
this.setMainViewScenePath(`${ROOT_DIR}${sceneName}`);
|
|
8371
8252
|
}
|
|
8372
8253
|
await this.setMainViewSceneIndex(nextIndex);
|
|
@@ -8664,7 +8545,7 @@ class AppManager {
|
|
|
8664
8545
|
const pageName = scenePath.replace(sceneDir, "").replace("/", "");
|
|
8665
8546
|
const index2 = scenes.findIndex((scene) => scene.name === pageName);
|
|
8666
8547
|
if (isInteger(index2) && index2 >= 0) {
|
|
8667
|
-
console.log("[window-manager] updateSceneIndex "
|
|
8548
|
+
console.log("[window-manager] updateSceneIndex " + index2);
|
|
8668
8549
|
this.safeSetAttributes({ _mainSceneIndex: index2 });
|
|
8669
8550
|
}
|
|
8670
8551
|
}
|
|
@@ -8932,7 +8813,6 @@ class AppManager {
|
|
|
8932
8813
|
(_a = this.boxManager) == null ? void 0 : _a.setMinimized(Boolean(this.store.getMinimized()));
|
|
8933
8814
|
}
|
|
8934
8815
|
bindMainView(divElement, disableCameraTransform) {
|
|
8935
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
8936
8816
|
const mainView = this.mainViewProxy.view;
|
|
8937
8817
|
mainView.disableCameraTransform = disableCameraTransform;
|
|
8938
8818
|
mainView.divElement = divElement;
|
|
@@ -8943,13 +8823,12 @@ class AppManager {
|
|
|
8943
8823
|
callbacks$1.emit("onMainViewMounted", mainView);
|
|
8944
8824
|
const hasRoot = this.hasRoot(mainView.divElement);
|
|
8945
8825
|
const rect = this.getRectByDivElement(mainView.divElement);
|
|
8946
|
-
|
|
8947
|
-
|
|
8948
|
-
|
|
8949
|
-
|
|
8950
|
-
|
|
8951
|
-
|
|
8952
|
-
);
|
|
8826
|
+
let log2 = `[window-manager] bindMainView hasRoot:${hasRoot}, rect:${JSON.stringify(rect)}, outerHeight:${window.outerHeight}, outerWidth:${window.outerWidth}`;
|
|
8827
|
+
const visualViewport = window.visualViewport;
|
|
8828
|
+
if (visualViewport) {
|
|
8829
|
+
log2 += `, visualViewportWidth:${visualViewport.width}, visualViewportHeight:${visualViewport.height}, visualViewportOffsetLeft:${visualViewport.offsetLeft}, visualViewportOffsetTop:${visualViewport.offsetTop}`;
|
|
8830
|
+
}
|
|
8831
|
+
console.log(log2);
|
|
8953
8832
|
}
|
|
8954
8833
|
hasRoot(divElement) {
|
|
8955
8834
|
let current = divElement;
|
|
@@ -9075,7 +8954,7 @@ class AppManager {
|
|
|
9075
8954
|
async _setMainViewScenePath(scenePath) {
|
|
9076
8955
|
const success = this.setMainViewFocusPath(scenePath);
|
|
9077
8956
|
if (success) {
|
|
9078
|
-
console.log("[window-manager] _setMainViewScenePath
|
|
8957
|
+
console.log("[window-manager] _setMainViewScenePath " + scenePath);
|
|
9079
8958
|
this.safeSetAttributes({ _mainScenePath: scenePath });
|
|
9080
8959
|
this.store.setMainViewFocusPath(this.mainView);
|
|
9081
8960
|
this.updateSceneIndex();
|
|
@@ -9103,7 +8982,6 @@ class AppManager {
|
|
|
9103
8982
|
}
|
|
9104
8983
|
}
|
|
9105
8984
|
dispatchSetMainViewScenePath(scenePath) {
|
|
9106
|
-
console.log("[window-manager] dispatchSetMainViewScenePath ", JSON.stringify(scenePath));
|
|
9107
8985
|
this.dispatchInternalEvent(Events.SetMainViewScenePath, { nextScenePath: scenePath });
|
|
9108
8986
|
callbacks$1.emit("mainViewScenePathChange", scenePath);
|
|
9109
8987
|
setScenePath(this.room, scenePath);
|
|
@@ -9179,6 +9057,7 @@ const ResizeObserver$2 = window.ResizeObserver || ResizeObserver$3;
|
|
|
9179
9057
|
class ContainerResizeObserver {
|
|
9180
9058
|
constructor(emitter) {
|
|
9181
9059
|
this.emitter = emitter;
|
|
9060
|
+
this.updateSizerLocalConsole = new LocalConsole("updateSizer", 30);
|
|
9182
9061
|
}
|
|
9183
9062
|
static create(container, sizer, wrapper, emitter) {
|
|
9184
9063
|
const containerResizeObserver = new ContainerResizeObserver(emitter);
|
|
@@ -9186,20 +9065,17 @@ class ContainerResizeObserver {
|
|
|
9186
9065
|
return containerResizeObserver;
|
|
9187
9066
|
}
|
|
9188
9067
|
observePlaygroundSize(container, sizer, wrapper) {
|
|
9189
|
-
console.log(`[window-manager] observePlaygroundSize ${JSON.stringify(container.getBoundingClientRect())}, ${JSON.stringify(sizer.getBoundingClientRect())}, ${JSON.stringify(wrapper.getBoundingClientRect())}`);
|
|
9190
9068
|
this.updateSizer(container.getBoundingClientRect(), sizer, wrapper, "observePlaygroundSize");
|
|
9191
9069
|
this.containerResizeObserver = new ResizeObserver$2((entries) => {
|
|
9192
9070
|
var _a;
|
|
9193
9071
|
const containerRect = (_a = entries[0]) == null ? void 0 : _a.contentRect;
|
|
9194
9072
|
if (containerRect) {
|
|
9195
9073
|
this.updateSizer(containerRect, sizer, wrapper, "containerResizeObserver");
|
|
9196
|
-
console.log(`[window-manager] containerResizeObserver ${JSON.stringify(containerRect)}`);
|
|
9197
9074
|
this.emitter.emit("playgroundSizeChange", containerRect);
|
|
9198
9075
|
}
|
|
9199
9076
|
});
|
|
9200
9077
|
this.disposer = this.emitter.on("containerSizeRatioUpdate", () => {
|
|
9201
9078
|
const containerRect = container.getBoundingClientRect();
|
|
9202
|
-
console.log(`[window-manager] containerSizeRatioUpdate ${JSON.stringify(containerRect)}`);
|
|
9203
9079
|
this.updateSizer(containerRect, sizer, wrapper, "containerSizeRatioUpdate");
|
|
9204
9080
|
this.emitter.emit("playgroundSizeChange", containerRect);
|
|
9205
9081
|
});
|
|
@@ -9216,9 +9092,8 @@ class ContainerResizeObserver {
|
|
|
9216
9092
|
}
|
|
9217
9093
|
wrapper.style.width = `${width}px`;
|
|
9218
9094
|
wrapper.style.height = `${height}px`;
|
|
9219
|
-
wrapper.style.backgroundColor = "green";
|
|
9220
9095
|
const wrapperRect = wrapper.getBoundingClientRect();
|
|
9221
|
-
|
|
9096
|
+
this.updateSizerLocalConsole.log(`from ${origin}, traget size: ${JSON.stringify({ width, height })}, wrapperRect: ${wrapperRect.width} ${wrapperRect.height}`);
|
|
9222
9097
|
this.emitter.emit("wrapperRectChange", {
|
|
9223
9098
|
width: wrapperRect.width,
|
|
9224
9099
|
height: wrapperRect.height,
|
|
@@ -9385,10 +9260,24 @@ const replaceRoomFunction = (room, manager) => {
|
|
|
9385
9260
|
var _a;
|
|
9386
9261
|
_scalePptToFit.call(room, ...args);
|
|
9387
9262
|
if ((_a = manager.appManager) == null ? void 0 : _a.mainViewProxy) {
|
|
9388
|
-
console.log("[window-manager] scalePptToFit " + JSON.stringify(args));
|
|
9389
9263
|
manager.appManager.mainViewProxy.setCameraAndSize();
|
|
9390
9264
|
}
|
|
9391
9265
|
};
|
|
9266
|
+
const _putScenes = room.putScenes;
|
|
9267
|
+
room.putScenes = (...args) => {
|
|
9268
|
+
const [path, scenes] = args;
|
|
9269
|
+
const currentScenePath = manager.mainView.focusScenePath;
|
|
9270
|
+
if (currentScenePath && path && scenes) {
|
|
9271
|
+
console.log("[window-manager] putScenes " + JSON.stringify(args));
|
|
9272
|
+
for (const scene of scenes) {
|
|
9273
|
+
if (`${path}${scene.name}` === currentScenePath) {
|
|
9274
|
+
console.error(`[window-manager] putScenes: scene name can not be the same as the current scene path: ${currentScenePath}`);
|
|
9275
|
+
return;
|
|
9276
|
+
}
|
|
9277
|
+
}
|
|
9278
|
+
}
|
|
9279
|
+
return _putScenes.call(room, ...args);
|
|
9280
|
+
};
|
|
9392
9281
|
room.moveCamera = (camera) => manager.moveCamera(camera);
|
|
9393
9282
|
room.moveCameraToContain = (...args) => manager.moveCameraToContain(...args);
|
|
9394
9283
|
room.convertToPointInWorld = (...args) => manager.mainView.convertToPointInWorld(...args);
|
|
@@ -19979,7 +19868,7 @@ const reconnectRefresher = new ReconnectRefresher({ emitter: internalEmitter });
|
|
|
19979
19868
|
const _WindowManager = class extends InvisiblePlugin {
|
|
19980
19869
|
constructor(context) {
|
|
19981
19870
|
super(context);
|
|
19982
|
-
this.version = "1.0.13-test.
|
|
19871
|
+
this.version = "1.0.13-test.19";
|
|
19983
19872
|
this.dependencies = { "dependencies": { "@juggle/resize-observer": "^3.3.1", "@netless/telebox-insider": "0.3.0", "emittery": "^0.9.2", "lodash": "^4.17.21", "p-retry": "^4.6.1", "uuid": "^7.0.3", "video.js": ">=7" }, "peerDependencies": { "jspdf": "2.5.1", "white-web-sdk": "^2.16.53" }, "devDependencies": { "@hyrious/dts": "^0.2.2", "@netless/app-docs-viewer": "^0.2.19", "@netless/app-media-player": "0.1.4", "@rollup/plugin-commonjs": "^20.0.0", "@rollup/plugin-node-resolve": "^13.0.4", "@rollup/plugin-url": "^6.1.0", "@sveltejs/vite-plugin-svelte": "1.0.0-next.30", "@tsconfig/svelte": "^2.0.1", "@types/debug": "^4.1.7", "@types/lodash": "^4.14.182", "@types/lodash-es": "^4.17.4", "@types/uuid": "^8.3.1", "@typescript-eslint/eslint-plugin": "^4.30.0", "@typescript-eslint/parser": "^4.30.0", "@vitest/ui": "^0.14.1", "cypress": "^8.7.0", "dotenv": "^10.0.0", "eslint": "^7.32.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-svelte3": "^3.2.0", "jsdom": "^19.0.0", "jspdf": "^2.5.1", "less": "^4.1.1", "prettier": "^2.3.2", "prettier-plugin-svelte": "^2.4.0", "rollup-plugin-analyzer": "^4.0.0", "rollup-plugin-styles": "^3.14.1", "side-effect-manager": "0.1.5", "svelte": "^3.42.4", "typescript": "^4.5.5", "vite": "^2.9.9", "vitest": "^0.14.1", "white-web-sdk": "^2.16.53" } };
|
|
19984
19873
|
this.emitter = callbacks$1;
|
|
19985
19874
|
this.viewMode = ViewMode.Broadcaster;
|
|
@@ -19997,12 +19886,14 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
|
19997
19886
|
const backgroundImageRect = backgroundImage == null ? void 0 : backgroundImage.getBoundingClientRect();
|
|
19998
19887
|
const backgroundImageCSS = window.getComputedStyle(backgroundImage);
|
|
19999
19888
|
const backgroundImageVisible = (backgroundImageRect == null ? void 0 : backgroundImageRect.width) > 0 && (backgroundImageRect == null ? void 0 : backgroundImageRect.height) > 0 && backgroundImageCSS.display !== "none";
|
|
20000
|
-
|
|
19889
|
+
const camera = this.mainView.camera;
|
|
19890
|
+
console.log("[window-manager] backgroundImageVisible:" + backgroundImageVisible + " camera:" + JSON.stringify(camera));
|
|
20001
19891
|
return;
|
|
20002
19892
|
}
|
|
20003
|
-
console.log("[window-manager] onMainViewScenePathChange" + scenePath + "backgroundImageVisible is not found");
|
|
19893
|
+
console.log("[window-manager] onMainViewScenePathChange scenePath:" + scenePath + " backgroundImageVisible is not found");
|
|
19894
|
+
return;
|
|
20004
19895
|
}
|
|
20005
|
-
console.log("[window-manager] onMainViewScenePathChange" + scenePath + "mainViewElement is not found");
|
|
19896
|
+
console.log("[window-manager] onMainViewScenePathChange scenePath:" + scenePath + " mainViewElement is not found");
|
|
20006
19897
|
};
|
|
20007
19898
|
_WindowManager.displayer = context.displayer;
|
|
20008
19899
|
window.NETLESS_DEPS = { "dependencies": { "@juggle/resize-observer": "^3.3.1", "@netless/telebox-insider": "0.3.0", "emittery": "^0.9.2", "lodash": "^4.17.21", "p-retry": "^4.6.1", "uuid": "^7.0.3", "video.js": ">=7" }, "peerDependencies": { "jspdf": "2.5.1", "white-web-sdk": "^2.16.53" }, "devDependencies": { "@hyrious/dts": "^0.2.2", "@netless/app-docs-viewer": "^0.2.19", "@netless/app-media-player": "0.1.4", "@rollup/plugin-commonjs": "^20.0.0", "@rollup/plugin-node-resolve": "^13.0.4", "@rollup/plugin-url": "^6.1.0", "@sveltejs/vite-plugin-svelte": "1.0.0-next.30", "@tsconfig/svelte": "^2.0.1", "@types/debug": "^4.1.7", "@types/lodash": "^4.14.182", "@types/lodash-es": "^4.17.4", "@types/uuid": "^8.3.1", "@typescript-eslint/eslint-plugin": "^4.30.0", "@typescript-eslint/parser": "^4.30.0", "@vitest/ui": "^0.14.1", "cypress": "^8.7.0", "dotenv": "^10.0.0", "eslint": "^7.32.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-svelte3": "^3.2.0", "jsdom": "^19.0.0", "jspdf": "^2.5.1", "less": "^4.1.1", "prettier": "^2.3.2", "prettier-plugin-svelte": "^2.4.0", "rollup-plugin-analyzer": "^4.0.0", "rollup-plugin-styles": "^3.14.1", "side-effect-manager": "0.1.5", "svelte": "^3.42.4", "typescript": "^4.5.5", "vite": "^2.9.9", "vitest": "^0.14.1", "white-web-sdk": "^2.16.53" } };
|
|
@@ -20653,7 +20544,6 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
|
20653
20544
|
}, 500);
|
|
20654
20545
|
}
|
|
20655
20546
|
moveCameraToContain(rectangle) {
|
|
20656
|
-
console.log("[window-manager] moveCameraToContain" + JSON.stringify(rectangle));
|
|
20657
20547
|
this.mainView.moveCameraToContain(rectangle);
|
|
20658
20548
|
setTimeout(() => {
|
|
20659
20549
|
var _a;
|