@netless/window-manager 1.0.13-test.17 → 1.0.13-test.18
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 +14 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +42 -164
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/AppManager.ts +11 -10
- package/src/AttributesDelegate.ts +5 -5
- package/src/BoxManager.ts +0 -1
- package/src/ContainerResizeObserver.ts +4 -5
- package/src/Utils/Common.ts +1 -1
- package/src/Utils/RoomHacker.ts +1 -1
- package/src/View/MainView.ts +16 -147
- package/src/index.ts +5 -5
package/dist/index.mjs
CHANGED
|
@@ -352,7 +352,7 @@ 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
|
|
355
|
+
console.log("[window-manager] real setScenePath for current room " + nextScenePath);
|
|
356
356
|
room.setScenePath(nextScenePath);
|
|
357
357
|
}
|
|
358
358
|
}
|
|
@@ -5626,7 +5626,6 @@ class BoxManager {
|
|
|
5626
5626
|
const rect = (_a = this.mainView.divElement) == null ? void 0 : _a.getBoundingClientRect();
|
|
5627
5627
|
if (rect && rect.width > 0 && rect.height > 0) {
|
|
5628
5628
|
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
5629
|
this.teleBoxManager.setContainerRect(containerRect);
|
|
5631
5630
|
this.context.notifyContainerRectUpdate(this.teleBoxManager.containerRect);
|
|
5632
5631
|
}
|
|
@@ -7034,7 +7033,7 @@ var Fields = /* @__PURE__ */ ((Fields2) => {
|
|
|
7034
7033
|
class AttributesDelegate {
|
|
7035
7034
|
constructor(context) {
|
|
7036
7035
|
this.context = context;
|
|
7037
|
-
this.setMainViewCameraConsole = new LocalConsole("setMainViewCamera",
|
|
7036
|
+
this.setMainViewCameraConsole = new LocalConsole("setMainViewCamera", 30);
|
|
7038
7037
|
this.setAppFocus = (appId, focus) => {
|
|
7039
7038
|
if (focus) {
|
|
7040
7039
|
this.context.safeSetAttributes({ ["focus"]: appId });
|
|
@@ -7160,11 +7159,11 @@ class AttributesDelegate {
|
|
|
7160
7159
|
return this.attributes["boxState"];
|
|
7161
7160
|
}
|
|
7162
7161
|
setMainViewScenePath(scenePath) {
|
|
7163
|
-
console.log("[window-manager] setMainViewScenePath "
|
|
7162
|
+
console.log("[window-manager] setMainViewScenePath " + scenePath);
|
|
7164
7163
|
this.context.safeSetAttributes({ _mainScenePath: scenePath });
|
|
7165
7164
|
}
|
|
7166
7165
|
setMainViewSceneIndex(index2) {
|
|
7167
|
-
console.log("[window-manager] setMainViewSceneIndex "
|
|
7166
|
+
console.log("[window-manager] setMainViewSceneIndex " + index2);
|
|
7168
7167
|
this.context.safeSetAttributes({ _mainSceneIndex: index2 });
|
|
7169
7168
|
}
|
|
7170
7169
|
getMainViewCamera() {
|
|
@@ -7180,13 +7179,13 @@ class AttributesDelegate {
|
|
|
7180
7179
|
setMainViewSize(size2) {
|
|
7181
7180
|
if (size2.width === 0 || size2.height === 0)
|
|
7182
7181
|
return;
|
|
7183
|
-
console.log("[window-manager] setMainViewSize
|
|
7182
|
+
console.log("[window-manager] setMainViewSize size:" + JSON.stringify(size2));
|
|
7184
7183
|
this.context.safeSetAttributes({ ["mainViewSize"]: { ...size2 } });
|
|
7185
7184
|
}
|
|
7186
7185
|
setMainViewCameraAndSize(camera, size2) {
|
|
7187
7186
|
if (size2.width === 0 || size2.height === 0)
|
|
7188
7187
|
return;
|
|
7189
|
-
console.log("[window-manager] setMainViewCameraAndSize
|
|
7188
|
+
console.log("[window-manager] setMainViewCameraAndSize camera:" + JSON.stringify(camera) + ", size:" + JSON.stringify(size2));
|
|
7190
7189
|
this.context.safeSetAttributes({
|
|
7191
7190
|
["mainViewCamera"]: { ...camera },
|
|
7192
7191
|
["mainViewSize"]: { ...size2 }
|
|
@@ -7797,6 +7796,8 @@ class MainViewProxy {
|
|
|
7797
7796
|
this.viewMode = this.manager.windowManger.viewMode;
|
|
7798
7797
|
this.sideEffectManager = new o$2();
|
|
7799
7798
|
this.playgroundSizeChangeListenerLocalConsole = new LocalConsole("playgroundSizeChangeListener", 30);
|
|
7799
|
+
this.sizeUpdatedLocalConsole = new LocalConsole("sizeUpdated", 30);
|
|
7800
|
+
this.cameraUpdatedLocalConsole = new LocalConsole("cameraUpdated", 30);
|
|
7800
7801
|
this.syncCamera = () => {
|
|
7801
7802
|
if (!this.polling || this.viewMode !== ViewMode.Broadcaster)
|
|
7802
7803
|
return;
|
|
@@ -7818,10 +7819,6 @@ class MainViewProxy {
|
|
|
7818
7819
|
};
|
|
7819
7820
|
this.onWrapperRectChange = (payload) => {
|
|
7820
7821
|
this.pendingWrapperRectChange = payload;
|
|
7821
|
-
console.log("[window-manager] onWrapperRectChange " + JSON.stringify({
|
|
7822
|
-
...payload,
|
|
7823
|
-
viewSize: this.mainView.size
|
|
7824
|
-
}));
|
|
7825
7822
|
if (this.wrapperRectWorkaroundFrame) {
|
|
7826
7823
|
cancelAnimationFrame(this.wrapperRectWorkaroundFrame);
|
|
7827
7824
|
}
|
|
@@ -7838,14 +7835,6 @@ class MainViewProxy {
|
|
|
7838
7835
|
const observedSize = { width: rect.width, height: rect.height };
|
|
7839
7836
|
const wrapperMatchesDom = Math.abs(payload.width - observedSize.width) <= 0.5 && Math.abs(payload.height - observedSize.height) <= 0.5;
|
|
7840
7837
|
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
7838
|
if (wrapperMatchesDom && viewIsStale) {
|
|
7850
7839
|
this.forceSyncMainViewDivElement(
|
|
7851
7840
|
`wrapperRectChange:${payload.origin || "unknown"}`,
|
|
@@ -7874,7 +7863,7 @@ class MainViewProxy {
|
|
|
7874
7863
|
if (size2) {
|
|
7875
7864
|
this.moveCameraToContian(size2);
|
|
7876
7865
|
this.moveCamera(this.mainViewCamera);
|
|
7877
|
-
console.log("[window-manager] sizeChangeHandler
|
|
7866
|
+
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
7867
|
}
|
|
7879
7868
|
this.ensureMainViewSize();
|
|
7880
7869
|
}, 30);
|
|
@@ -7897,88 +7886,8 @@ class MainViewProxy {
|
|
|
7897
7886
|
this.setMainViewSize = debounce((size2) => {
|
|
7898
7887
|
this.store.setMainViewSize({ ...size2, id: this.manager.uid });
|
|
7899
7888
|
}, 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
7889
|
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
|
-
}
|
|
7890
|
+
this.handleCameraOrSizeUpdated = () => {
|
|
7982
7891
|
callbacks$1.emit("cameraStateChange", this.cameraState);
|
|
7983
7892
|
if (this.manager.room && this.manager.room.syncMainView) {
|
|
7984
7893
|
clearTimeout(this._syncMainViewTimer);
|
|
@@ -7987,10 +7896,12 @@ class MainViewProxy {
|
|
|
7987
7896
|
this.ensureMainViewSize();
|
|
7988
7897
|
};
|
|
7989
7898
|
this.onCameraUpdated = (camera) => {
|
|
7990
|
-
this.
|
|
7899
|
+
this.cameraUpdatedLocalConsole.log(JSON.stringify(camera));
|
|
7900
|
+
this.handleCameraOrSizeUpdated();
|
|
7991
7901
|
};
|
|
7992
7902
|
this.onSizeUpdated = (size2) => {
|
|
7993
|
-
this.
|
|
7903
|
+
this.sizeUpdatedLocalConsole.log(JSON.stringify(size2));
|
|
7904
|
+
this.handleCameraOrSizeUpdated();
|
|
7994
7905
|
};
|
|
7995
7906
|
this.syncMainView = (room) => {
|
|
7996
7907
|
if (room.isWritable) {
|
|
@@ -8004,7 +7915,6 @@ class MainViewProxy {
|
|
|
8004
7915
|
this.mainView = this.createMainView();
|
|
8005
7916
|
this.moveCameraSizeByAttributes();
|
|
8006
7917
|
internalEmitter.once("mainViewMounted").then(() => {
|
|
8007
|
-
this.observeMainViewDivElement();
|
|
8008
7918
|
this.addMainViewListener();
|
|
8009
7919
|
this.start();
|
|
8010
7920
|
this.ensureCameraAndSize();
|
|
@@ -8032,6 +7942,9 @@ class MainViewProxy {
|
|
|
8032
7942
|
this.sideEffectManager.add(() => {
|
|
8033
7943
|
return internalEmitter.on("containerSizeRatioUpdate", this.onUpdateContainerSizeRatio);
|
|
8034
7944
|
});
|
|
7945
|
+
this.sideEffectManager.add(() => {
|
|
7946
|
+
return internalEmitter.on("wrapperRectChange", this.onWrapperRectChange);
|
|
7947
|
+
});
|
|
8035
7948
|
this.sideEffectManager.add(() => {
|
|
8036
7949
|
return internalEmitter.on("startReconnect", () => {
|
|
8037
7950
|
if (!this.didRelease) {
|
|
@@ -8062,15 +7975,6 @@ class MainViewProxy {
|
|
|
8062
7975
|
this.moveCameraToContian(this.mainViewSize);
|
|
8063
7976
|
this.moveCamera(this.mainViewCamera);
|
|
8064
7977
|
}
|
|
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
7978
|
forceSyncMainViewDivElement(reason, observedSize, element2) {
|
|
8075
7979
|
const { width: viewWidth, height: viewHeight } = this.mainView.size;
|
|
8076
7980
|
if (Math.abs(viewWidth - observedSize.width) <= 0.5 && Math.abs(viewHeight - observedSize.height) <= 0.5) {
|
|
@@ -8105,7 +8009,7 @@ class MainViewProxy {
|
|
|
8105
8009
|
});
|
|
8106
8010
|
}
|
|
8107
8011
|
start() {
|
|
8108
|
-
console.log("[window-manager] start
|
|
8012
|
+
console.log("[window-manager] start attributes size:" + JSON.stringify(this.mainViewSize));
|
|
8109
8013
|
this.sizeChangeHandler(this.mainViewSize);
|
|
8110
8014
|
if (this.started)
|
|
8111
8015
|
return;
|
|
@@ -8114,7 +8018,10 @@ class MainViewProxy {
|
|
|
8114
8018
|
if (this.manager.room)
|
|
8115
8019
|
this.syncMainView(this.manager.room);
|
|
8116
8020
|
this.started = true;
|
|
8117
|
-
|
|
8021
|
+
if (this.mainView.focusScenePath) {
|
|
8022
|
+
this.manager.windowManger.onMainViewScenePathChangeHandler(this.mainView.focusScenePath);
|
|
8023
|
+
}
|
|
8024
|
+
console.log("[window-manager] start end mainView size:" + JSON.stringify(this.mainView.size));
|
|
8118
8025
|
}
|
|
8119
8026
|
setCameraAndSize() {
|
|
8120
8027
|
const camera = { ...this.mainView.camera, id: this.manager.uid };
|
|
@@ -8156,11 +8063,9 @@ class MainViewProxy {
|
|
|
8156
8063
|
this.mainView.release();
|
|
8157
8064
|
}
|
|
8158
8065
|
this.removeMainViewListener();
|
|
8159
|
-
this.disconnectMainViewResizeObserver();
|
|
8160
8066
|
this.mainView = this.createMainView();
|
|
8161
8067
|
this.mainView.disableCameraTransform = disableCameraTransform;
|
|
8162
8068
|
this.mainView.divElement = divElement;
|
|
8163
|
-
this.observeMainViewDivElement();
|
|
8164
8069
|
this.addMainViewListener();
|
|
8165
8070
|
this.start();
|
|
8166
8071
|
callbacks$1.emit("onMainViewRebind", this.mainView);
|
|
@@ -8198,28 +8103,6 @@ class MainViewProxy {
|
|
|
8198
8103
|
this.view.callbacks.off("onCameraUpdated", this.onCameraUpdated);
|
|
8199
8104
|
this.view.callbacks.off("onSizeUpdated", this.onSizeUpdated);
|
|
8200
8105
|
}
|
|
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
8106
|
ensureMainViewSize() {
|
|
8224
8107
|
if ((!this.mainViewSize || this.mainViewSize.width === 0 || this.mainViewSize.height === 0) && this.mainView.size.width > 0 && this.mainView.size.height > 0) {
|
|
8225
8108
|
this.setMainViewSize(this.mainView.size);
|
|
@@ -8264,7 +8147,6 @@ class MainViewProxy {
|
|
|
8264
8147
|
this.wrapperRectWorkaroundFrame = 0;
|
|
8265
8148
|
}
|
|
8266
8149
|
this.removeMainViewListener();
|
|
8267
|
-
this.disconnectMainViewResizeObserver();
|
|
8268
8150
|
this.stop();
|
|
8269
8151
|
this.sideEffectManager.flushAll();
|
|
8270
8152
|
}
|
|
@@ -8353,7 +8235,7 @@ class AppManager {
|
|
|
8353
8235
|
var _a, _b;
|
|
8354
8236
|
const { scenePath } = params;
|
|
8355
8237
|
if (scenePath === ROOT_DIR) {
|
|
8356
|
-
console.log("[window-manager] onRemoveScenes
|
|
8238
|
+
console.log("[window-manager] onRemoveScenes ROOT_DIR");
|
|
8357
8239
|
await this.onRootDirRemoved();
|
|
8358
8240
|
this.dispatchInternalEvent(Events.RootDirRemoved);
|
|
8359
8241
|
return;
|
|
@@ -8366,7 +8248,7 @@ class AppManager {
|
|
|
8366
8248
|
sceneName = (_b = this.callbacksNode) == null ? void 0 : _b.scenes[nextIndex];
|
|
8367
8249
|
}
|
|
8368
8250
|
if (sceneName) {
|
|
8369
|
-
console.log(`[window-manager] onRemoveScenes
|
|
8251
|
+
console.log(`[window-manager] onRemoveScenes setMainViewScenePath ${ROOT_DIR}${sceneName}`);
|
|
8370
8252
|
this.setMainViewScenePath(`${ROOT_DIR}${sceneName}`);
|
|
8371
8253
|
}
|
|
8372
8254
|
await this.setMainViewSceneIndex(nextIndex);
|
|
@@ -8664,7 +8546,7 @@ class AppManager {
|
|
|
8664
8546
|
const pageName = scenePath.replace(sceneDir, "").replace("/", "");
|
|
8665
8547
|
const index2 = scenes.findIndex((scene) => scene.name === pageName);
|
|
8666
8548
|
if (isInteger(index2) && index2 >= 0) {
|
|
8667
|
-
console.log("[window-manager] updateSceneIndex "
|
|
8549
|
+
console.log("[window-manager] updateSceneIndex " + index2);
|
|
8668
8550
|
this.safeSetAttributes({ _mainSceneIndex: index2 });
|
|
8669
8551
|
}
|
|
8670
8552
|
}
|
|
@@ -8932,7 +8814,6 @@ class AppManager {
|
|
|
8932
8814
|
(_a = this.boxManager) == null ? void 0 : _a.setMinimized(Boolean(this.store.getMinimized()));
|
|
8933
8815
|
}
|
|
8934
8816
|
bindMainView(divElement, disableCameraTransform) {
|
|
8935
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
8936
8817
|
const mainView = this.mainViewProxy.view;
|
|
8937
8818
|
mainView.disableCameraTransform = disableCameraTransform;
|
|
8938
8819
|
mainView.divElement = divElement;
|
|
@@ -8943,13 +8824,12 @@ class AppManager {
|
|
|
8943
8824
|
callbacks$1.emit("onMainViewMounted", mainView);
|
|
8944
8825
|
const hasRoot = this.hasRoot(mainView.divElement);
|
|
8945
8826
|
const rect = this.getRectByDivElement(mainView.divElement);
|
|
8946
|
-
|
|
8947
|
-
|
|
8948
|
-
|
|
8949
|
-
|
|
8950
|
-
|
|
8951
|
-
|
|
8952
|
-
);
|
|
8827
|
+
let log2 = `[window-manager] bindMainView hasRoot:${hasRoot}, rect:${JSON.stringify(rect)}, outerHeight:${window.outerHeight}, outerWidth:${window.outerWidth}`;
|
|
8828
|
+
const visualViewport = window.visualViewport;
|
|
8829
|
+
if (visualViewport) {
|
|
8830
|
+
log2 += `, visualViewportWidth:${visualViewport.width}, visualViewportHeight:${visualViewport.height}, visualViewportOffsetLeft:${visualViewport.offsetLeft}, visualViewportOffsetTop:${visualViewport.offsetTop}`;
|
|
8831
|
+
}
|
|
8832
|
+
console.log(log2);
|
|
8953
8833
|
}
|
|
8954
8834
|
hasRoot(divElement) {
|
|
8955
8835
|
let current = divElement;
|
|
@@ -9075,7 +8955,7 @@ class AppManager {
|
|
|
9075
8955
|
async _setMainViewScenePath(scenePath) {
|
|
9076
8956
|
const success = this.setMainViewFocusPath(scenePath);
|
|
9077
8957
|
if (success) {
|
|
9078
|
-
console.log("[window-manager] _setMainViewScenePath
|
|
8958
|
+
console.log("[window-manager] _setMainViewScenePath " + scenePath);
|
|
9079
8959
|
this.safeSetAttributes({ _mainScenePath: scenePath });
|
|
9080
8960
|
this.store.setMainViewFocusPath(this.mainView);
|
|
9081
8961
|
this.updateSceneIndex();
|
|
@@ -9103,7 +8983,7 @@ class AppManager {
|
|
|
9103
8983
|
}
|
|
9104
8984
|
}
|
|
9105
8985
|
dispatchSetMainViewScenePath(scenePath) {
|
|
9106
|
-
console.log("[window-manager] dispatchSetMainViewScenePath "
|
|
8986
|
+
console.log("[window-manager] dispatchSetMainViewScenePath " + scenePath);
|
|
9107
8987
|
this.dispatchInternalEvent(Events.SetMainViewScenePath, { nextScenePath: scenePath });
|
|
9108
8988
|
callbacks$1.emit("mainViewScenePathChange", scenePath);
|
|
9109
8989
|
setScenePath(this.room, scenePath);
|
|
@@ -9179,6 +9059,7 @@ const ResizeObserver$2 = window.ResizeObserver || ResizeObserver$3;
|
|
|
9179
9059
|
class ContainerResizeObserver {
|
|
9180
9060
|
constructor(emitter) {
|
|
9181
9061
|
this.emitter = emitter;
|
|
9062
|
+
this.updateSizerLocalConsole = new LocalConsole("updateSizer", 30);
|
|
9182
9063
|
}
|
|
9183
9064
|
static create(container, sizer, wrapper, emitter) {
|
|
9184
9065
|
const containerResizeObserver = new ContainerResizeObserver(emitter);
|
|
@@ -9186,20 +9067,17 @@ class ContainerResizeObserver {
|
|
|
9186
9067
|
return containerResizeObserver;
|
|
9187
9068
|
}
|
|
9188
9069
|
observePlaygroundSize(container, sizer, wrapper) {
|
|
9189
|
-
console.log(`[window-manager] observePlaygroundSize ${JSON.stringify(container.getBoundingClientRect())}, ${JSON.stringify(sizer.getBoundingClientRect())}, ${JSON.stringify(wrapper.getBoundingClientRect())}`);
|
|
9190
9070
|
this.updateSizer(container.getBoundingClientRect(), sizer, wrapper, "observePlaygroundSize");
|
|
9191
9071
|
this.containerResizeObserver = new ResizeObserver$2((entries) => {
|
|
9192
9072
|
var _a;
|
|
9193
9073
|
const containerRect = (_a = entries[0]) == null ? void 0 : _a.contentRect;
|
|
9194
9074
|
if (containerRect) {
|
|
9195
9075
|
this.updateSizer(containerRect, sizer, wrapper, "containerResizeObserver");
|
|
9196
|
-
console.log(`[window-manager] containerResizeObserver ${JSON.stringify(containerRect)}`);
|
|
9197
9076
|
this.emitter.emit("playgroundSizeChange", containerRect);
|
|
9198
9077
|
}
|
|
9199
9078
|
});
|
|
9200
9079
|
this.disposer = this.emitter.on("containerSizeRatioUpdate", () => {
|
|
9201
9080
|
const containerRect = container.getBoundingClientRect();
|
|
9202
|
-
console.log(`[window-manager] containerSizeRatioUpdate ${JSON.stringify(containerRect)}`);
|
|
9203
9081
|
this.updateSizer(containerRect, sizer, wrapper, "containerSizeRatioUpdate");
|
|
9204
9082
|
this.emitter.emit("playgroundSizeChange", containerRect);
|
|
9205
9083
|
});
|
|
@@ -9216,9 +9094,8 @@ class ContainerResizeObserver {
|
|
|
9216
9094
|
}
|
|
9217
9095
|
wrapper.style.width = `${width}px`;
|
|
9218
9096
|
wrapper.style.height = `${height}px`;
|
|
9219
|
-
wrapper.style.backgroundColor = "green";
|
|
9220
9097
|
const wrapperRect = wrapper.getBoundingClientRect();
|
|
9221
|
-
|
|
9098
|
+
this.updateSizerLocalConsole.log(`from ${origin}, traget size: ${JSON.stringify({ width, height })}, wrapperRect: ${wrapperRect.width} ${wrapperRect.height}`);
|
|
9222
9099
|
this.emitter.emit("wrapperRectChange", {
|
|
9223
9100
|
width: wrapperRect.width,
|
|
9224
9101
|
height: wrapperRect.height,
|
|
@@ -9385,7 +9262,7 @@ const replaceRoomFunction = (room, manager) => {
|
|
|
9385
9262
|
var _a;
|
|
9386
9263
|
_scalePptToFit.call(room, ...args);
|
|
9387
9264
|
if ((_a = manager.appManager) == null ? void 0 : _a.mainViewProxy) {
|
|
9388
|
-
console.log("[window-manager] scalePptToFit
|
|
9265
|
+
console.log("[window-manager] scalePptToFit " + JSON.stringify(args));
|
|
9389
9266
|
manager.appManager.mainViewProxy.setCameraAndSize();
|
|
9390
9267
|
}
|
|
9391
9268
|
};
|
|
@@ -19979,7 +19856,7 @@ const reconnectRefresher = new ReconnectRefresher({ emitter: internalEmitter });
|
|
|
19979
19856
|
const _WindowManager = class extends InvisiblePlugin {
|
|
19980
19857
|
constructor(context) {
|
|
19981
19858
|
super(context);
|
|
19982
|
-
this.version = "1.0.13-test.
|
|
19859
|
+
this.version = "1.0.13-test.18";
|
|
19983
19860
|
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
19861
|
this.emitter = callbacks$1;
|
|
19985
19862
|
this.viewMode = ViewMode.Broadcaster;
|
|
@@ -19997,12 +19874,14 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
|
19997
19874
|
const backgroundImageRect = backgroundImage == null ? void 0 : backgroundImage.getBoundingClientRect();
|
|
19998
19875
|
const backgroundImageCSS = window.getComputedStyle(backgroundImage);
|
|
19999
19876
|
const backgroundImageVisible = (backgroundImageRect == null ? void 0 : backgroundImageRect.width) > 0 && (backgroundImageRect == null ? void 0 : backgroundImageRect.height) > 0 && backgroundImageCSS.display !== "none";
|
|
20000
|
-
|
|
19877
|
+
const camera = this.mainView.camera;
|
|
19878
|
+
console.log("[window-manager] backgroundImageVisible:" + backgroundImageVisible + " camera:" + JSON.stringify(camera));
|
|
20001
19879
|
return;
|
|
20002
19880
|
}
|
|
20003
|
-
console.log("[window-manager] onMainViewScenePathChange" + scenePath + "backgroundImageVisible is not found");
|
|
19881
|
+
console.log("[window-manager] onMainViewScenePathChange scenePath:" + scenePath + " backgroundImageVisible is not found");
|
|
19882
|
+
return;
|
|
20004
19883
|
}
|
|
20005
|
-
console.log("[window-manager] onMainViewScenePathChange" + scenePath + "mainViewElement is not found");
|
|
19884
|
+
console.log("[window-manager] onMainViewScenePathChange scenePath:" + scenePath + " mainViewElement is not found");
|
|
20006
19885
|
};
|
|
20007
19886
|
_WindowManager.displayer = context.displayer;
|
|
20008
19887
|
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 +20532,6 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
|
20653
20532
|
}, 500);
|
|
20654
20533
|
}
|
|
20655
20534
|
moveCameraToContain(rectangle) {
|
|
20656
|
-
console.log("[window-manager] moveCameraToContain" + JSON.stringify(rectangle));
|
|
20657
20535
|
this.mainView.moveCameraToContain(rectangle);
|
|
20658
20536
|
setTimeout(() => {
|
|
20659
20537
|
var _a;
|