@netless/window-manager 1.0.13-test.1 → 1.0.13-test.10
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 +6 -0
- package/dist/index.js +14 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +128 -16
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/AppListener.ts +1 -20
- package/src/AppManager.ts +29 -4
- package/src/AttributesDelegate.ts +7 -5
- package/src/BoxManager.ts +1 -0
- package/src/ContainerResizeObserver.ts +5 -0
- package/src/Utils/Common.ts +1 -1
- package/src/Utils/RoomHacker.ts +8 -1
- package/src/Utils/log.ts +37 -0
- package/src/View/MainView.ts +20 -5
- package/src/index.ts +29 -3
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
|
}
|
|
@@ -464,7 +464,7 @@ class AppListeners {
|
|
|
464
464
|
break;
|
|
465
465
|
}
|
|
466
466
|
case Events.SetMainViewScenePath: {
|
|
467
|
-
console.log("[window-manager] mainMagixEventListener
|
|
467
|
+
console.log("[window-manager] mainMagixEventListener " + JSON.stringify(data.payload));
|
|
468
468
|
this.setMainViewScenePathHandler(data.payload);
|
|
469
469
|
break;
|
|
470
470
|
}
|
|
@@ -5626,6 +5626,7 @@ 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);
|
|
5629
5630
|
this.teleBoxManager.setContainerRect(containerRect);
|
|
5630
5631
|
this.context.notifyContainerRectUpdate(this.teleBoxManager.containerRect);
|
|
5631
5632
|
}
|
|
@@ -5697,6 +5698,35 @@ const log = (...args) => {
|
|
|
5697
5698
|
console.log(`[WindowManager]:`, ...args);
|
|
5698
5699
|
}
|
|
5699
5700
|
};
|
|
5701
|
+
class LocalConsole {
|
|
5702
|
+
constructor(name, debounceTime) {
|
|
5703
|
+
this.name = name;
|
|
5704
|
+
this.debounceTime = debounceTime;
|
|
5705
|
+
this.pendingArgs = null;
|
|
5706
|
+
this.flushTimer = null;
|
|
5707
|
+
}
|
|
5708
|
+
flush() {
|
|
5709
|
+
this.flushTimer = null;
|
|
5710
|
+
const args = this.pendingArgs;
|
|
5711
|
+
this.pendingArgs = null;
|
|
5712
|
+
if (args === null) {
|
|
5713
|
+
return;
|
|
5714
|
+
}
|
|
5715
|
+
console.log(`[window-manager][${this.name}]: ${args.join(", ")}`);
|
|
5716
|
+
}
|
|
5717
|
+
log(...args) {
|
|
5718
|
+
const ms = this.debounceTime;
|
|
5719
|
+
if (ms != null && ms > 0) {
|
|
5720
|
+
this.pendingArgs = args;
|
|
5721
|
+
if (this.flushTimer != null) {
|
|
5722
|
+
clearTimeout(this.flushTimer);
|
|
5723
|
+
}
|
|
5724
|
+
this.flushTimer = setTimeout(() => this.flush(), ms);
|
|
5725
|
+
return;
|
|
5726
|
+
}
|
|
5727
|
+
console.log(`[window-manager][${this.name}]: ${args.join(", ")}`);
|
|
5728
|
+
}
|
|
5729
|
+
}
|
|
5700
5730
|
const setupWrapper = (root) => {
|
|
5701
5731
|
const playground = document.createElement("div");
|
|
5702
5732
|
playground.className = "netless-window-manager-playground";
|
|
@@ -7004,6 +7034,7 @@ var Fields = /* @__PURE__ */ ((Fields2) => {
|
|
|
7004
7034
|
class AttributesDelegate {
|
|
7005
7035
|
constructor(context) {
|
|
7006
7036
|
this.context = context;
|
|
7037
|
+
this.setMainViewCameraConsole = new LocalConsole("setMainViewCamera", 50);
|
|
7007
7038
|
this.setAppFocus = (appId, focus) => {
|
|
7008
7039
|
if (focus) {
|
|
7009
7040
|
this.context.safeSetAttributes({ ["focus"]: appId });
|
|
@@ -7129,11 +7160,11 @@ class AttributesDelegate {
|
|
|
7129
7160
|
return this.attributes["boxState"];
|
|
7130
7161
|
}
|
|
7131
7162
|
setMainViewScenePath(scenePath) {
|
|
7132
|
-
console.log("[window-manager] setMainViewScenePath
|
|
7163
|
+
console.log("[window-manager] setMainViewScenePath ", scenePath);
|
|
7133
7164
|
this.context.safeSetAttributes({ _mainScenePath: scenePath });
|
|
7134
7165
|
}
|
|
7135
7166
|
setMainViewSceneIndex(index2) {
|
|
7136
|
-
console.log("[window-manager] setMainViewSceneIndex
|
|
7167
|
+
console.log("[window-manager] setMainViewSceneIndex ", index2);
|
|
7137
7168
|
this.context.safeSetAttributes({ _mainSceneIndex: index2 });
|
|
7138
7169
|
}
|
|
7139
7170
|
getMainViewCamera() {
|
|
@@ -7143,19 +7174,19 @@ class AttributesDelegate {
|
|
|
7143
7174
|
return get(this.attributes, ["mainViewSize"]);
|
|
7144
7175
|
}
|
|
7145
7176
|
setMainViewCamera(camera) {
|
|
7146
|
-
|
|
7177
|
+
this.setMainViewCameraConsole.log(JSON.stringify(camera));
|
|
7147
7178
|
this.context.safeSetAttributes({ ["mainViewCamera"]: { ...camera } });
|
|
7148
7179
|
}
|
|
7149
7180
|
setMainViewSize(size2) {
|
|
7150
7181
|
if (size2.width === 0 || size2.height === 0)
|
|
7151
7182
|
return;
|
|
7152
|
-
console.log("[window-manager] setMainViewSize", size2);
|
|
7183
|
+
console.log("[window-manager] setMainViewSize ", JSON.stringify(size2));
|
|
7153
7184
|
this.context.safeSetAttributes({ ["mainViewSize"]: { ...size2 } });
|
|
7154
7185
|
}
|
|
7155
7186
|
setMainViewCameraAndSize(camera, size2) {
|
|
7156
7187
|
if (size2.width === 0 || size2.height === 0)
|
|
7157
7188
|
return;
|
|
7158
|
-
console.log("[window-manager] setMainViewCameraAndSize", camera, size2);
|
|
7189
|
+
console.log("[window-manager] setMainViewCameraAndSize ", JSON.stringify(camera), JSON.stringify(size2));
|
|
7159
7190
|
this.context.safeSetAttributes({
|
|
7160
7191
|
["mainViewCamera"]: { ...camera },
|
|
7161
7192
|
["mainViewSize"]: { ...size2 }
|
|
@@ -7753,6 +7784,7 @@ const setDefaultCameraBound = (view) => {
|
|
|
7753
7784
|
minContentMode: () => 0.1
|
|
7754
7785
|
});
|
|
7755
7786
|
};
|
|
7787
|
+
window.___local_log = window.___local_log || /* @__PURE__ */ new Set();
|
|
7756
7788
|
class MainViewProxy {
|
|
7757
7789
|
constructor(manager) {
|
|
7758
7790
|
this.manager = manager;
|
|
@@ -7762,6 +7794,7 @@ class MainViewProxy {
|
|
|
7762
7794
|
this.store = this.manager.store;
|
|
7763
7795
|
this.viewMode = this.manager.windowManger.viewMode;
|
|
7764
7796
|
this.sideEffectManager = new o$2();
|
|
7797
|
+
this.playgroundSizeChangeListenerLocalConsole = new LocalConsole("playgroundSizeChangeListener", 30);
|
|
7765
7798
|
this.syncCamera = () => {
|
|
7766
7799
|
if (!this.polling || this.viewMode !== ViewMode.Broadcaster)
|
|
7767
7800
|
return;
|
|
@@ -7789,7 +7822,7 @@ class MainViewProxy {
|
|
|
7789
7822
|
() => this.mainViewCamera,
|
|
7790
7823
|
(camera) => {
|
|
7791
7824
|
if (camera && camera.id !== this.manager.uid) {
|
|
7792
|
-
console.log("[window-manager] cameraReaction
|
|
7825
|
+
console.log("[window-manager] cameraReaction " + JSON.stringify(camera) + JSON.stringify(this.mainViewSize));
|
|
7793
7826
|
this.moveCameraToContian(this.mainViewSize);
|
|
7794
7827
|
this.moveCamera(camera);
|
|
7795
7828
|
}
|
|
@@ -7799,15 +7832,15 @@ class MainViewProxy {
|
|
|
7799
7832
|
};
|
|
7800
7833
|
this.sizeChangeHandler = debounce((size2) => {
|
|
7801
7834
|
if (size2) {
|
|
7802
|
-
console.log("[window-manager] sizeChangeHandler====>", size2, this.mainViewCamera);
|
|
7803
7835
|
this.moveCameraToContian(size2);
|
|
7804
7836
|
this.moveCamera(this.mainViewCamera);
|
|
7837
|
+
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));
|
|
7805
7838
|
}
|
|
7806
7839
|
this.ensureMainViewSize();
|
|
7807
7840
|
}, 30);
|
|
7808
7841
|
this.onUpdateContainerSizeRatio = () => {
|
|
7809
7842
|
const size2 = this.store.getMainViewSize();
|
|
7810
|
-
console.log("[window-manager] onUpdateContainerSizeRatio
|
|
7843
|
+
console.log("[window-manager] onUpdateContainerSizeRatio " + JSON.stringify(size2));
|
|
7811
7844
|
this.sizeChangeHandler(size2);
|
|
7812
7845
|
};
|
|
7813
7846
|
this.onCameraUpdatedByDevice = (camera) => {
|
|
@@ -7826,6 +7859,7 @@ class MainViewProxy {
|
|
|
7826
7859
|
}, 50);
|
|
7827
7860
|
this._syncMainViewTimer = 0;
|
|
7828
7861
|
this.onCameraOrSizeUpdated = () => {
|
|
7862
|
+
console.log("[window-manager] onCameraOrSizeUpdated " + JSON.stringify(this.cameraState));
|
|
7829
7863
|
callbacks$1.emit("cameraStateChange", this.cameraState);
|
|
7830
7864
|
if (this.manager.room && this.manager.room.syncMainView) {
|
|
7831
7865
|
clearTimeout(this._syncMainViewTimer);
|
|
@@ -7835,6 +7869,7 @@ class MainViewProxy {
|
|
|
7835
7869
|
};
|
|
7836
7870
|
this.syncMainView = (room) => {
|
|
7837
7871
|
if (room.isWritable) {
|
|
7872
|
+
console.log("[window-manager] syncMainView ");
|
|
7838
7873
|
room.syncMainView(this.mainView);
|
|
7839
7874
|
}
|
|
7840
7875
|
};
|
|
@@ -7850,7 +7885,19 @@ class MainViewProxy {
|
|
|
7850
7885
|
this.startListenWritableChange();
|
|
7851
7886
|
});
|
|
7852
7887
|
const playgroundSizeChangeListener = () => {
|
|
7853
|
-
|
|
7888
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
7889
|
+
this.playgroundSizeChangeListenerLocalConsole.log(
|
|
7890
|
+
JSON.stringify(this.mainView.camera),
|
|
7891
|
+
JSON.stringify(this.mainView.size),
|
|
7892
|
+
JSON.stringify(this.mainViewSize),
|
|
7893
|
+
JSON.stringify(this.mainViewCamera),
|
|
7894
|
+
window.outerHeight,
|
|
7895
|
+
window.outerWidth,
|
|
7896
|
+
(_b = (_a = window.visualViewport) == null ? void 0 : _a.width) != null ? _b : "null",
|
|
7897
|
+
(_d = (_c = window.visualViewport) == null ? void 0 : _c.height) != null ? _d : "null",
|
|
7898
|
+
(_f = (_e = window.visualViewport) == null ? void 0 : _e.offsetLeft) != null ? _f : "null",
|
|
7899
|
+
(_h = (_g = window.visualViewport) == null ? void 0 : _g.offsetTop) != null ? _h : "null"
|
|
7900
|
+
);
|
|
7854
7901
|
this.sizeChangeHandler(this.mainViewSize);
|
|
7855
7902
|
};
|
|
7856
7903
|
this.sideEffectManager.add(() => {
|
|
@@ -7890,7 +7937,7 @@ class MainViewProxy {
|
|
|
7890
7937
|
this.moveCamera(this.mainViewCamera);
|
|
7891
7938
|
}
|
|
7892
7939
|
start() {
|
|
7893
|
-
console.log("[window-manager] start
|
|
7940
|
+
console.log("[window-manager] start " + JSON.stringify(this.mainViewSize));
|
|
7894
7941
|
this.sizeChangeHandler(this.mainViewSize);
|
|
7895
7942
|
if (this.started)
|
|
7896
7943
|
return;
|
|
@@ -8107,6 +8154,7 @@ class AppManager {
|
|
|
8107
8154
|
var _a, _b;
|
|
8108
8155
|
const { scenePath } = params;
|
|
8109
8156
|
if (scenePath === ROOT_DIR) {
|
|
8157
|
+
console.log("[window-manager] onRemoveScenes ROOT_DIR");
|
|
8110
8158
|
await this.onRootDirRemoved();
|
|
8111
8159
|
this.dispatchInternalEvent(Events.RootDirRemoved);
|
|
8112
8160
|
return;
|
|
@@ -8119,6 +8167,7 @@ class AppManager {
|
|
|
8119
8167
|
sceneName = (_b = this.callbacksNode) == null ? void 0 : _b.scenes[nextIndex];
|
|
8120
8168
|
}
|
|
8121
8169
|
if (sceneName) {
|
|
8170
|
+
console.log(`[window-manager] onRemoveScenes setMainViewScenePath${ROOT_DIR}${sceneName}`);
|
|
8122
8171
|
this.setMainViewScenePath(`${ROOT_DIR}${sceneName}`);
|
|
8123
8172
|
}
|
|
8124
8173
|
await this.setMainViewSceneIndex(nextIndex);
|
|
@@ -8416,7 +8465,7 @@ class AppManager {
|
|
|
8416
8465
|
const pageName = scenePath.replace(sceneDir, "").replace("/", "");
|
|
8417
8466
|
const index2 = scenes.findIndex((scene) => scene.name === pageName);
|
|
8418
8467
|
if (isInteger(index2) && index2 >= 0) {
|
|
8419
|
-
console.log("[window-manager] updateSceneIndex
|
|
8468
|
+
console.log("[window-manager] updateSceneIndex ", index2);
|
|
8420
8469
|
this.safeSetAttributes({ _mainSceneIndex: index2 });
|
|
8421
8470
|
}
|
|
8422
8471
|
}
|
|
@@ -8684,6 +8733,7 @@ class AppManager {
|
|
|
8684
8733
|
(_a = this.boxManager) == null ? void 0 : _a.setMinimized(Boolean(this.store.getMinimized()));
|
|
8685
8734
|
}
|
|
8686
8735
|
bindMainView(divElement, disableCameraTransform) {
|
|
8736
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
8687
8737
|
const mainView = this.mainViewProxy.view;
|
|
8688
8738
|
mainView.disableCameraTransform = disableCameraTransform;
|
|
8689
8739
|
mainView.divElement = divElement;
|
|
@@ -8692,6 +8742,29 @@ class AppManager {
|
|
|
8692
8742
|
}
|
|
8693
8743
|
internalEmitter.emit("mainViewMounted");
|
|
8694
8744
|
callbacks$1.emit("onMainViewMounted", mainView);
|
|
8745
|
+
const hasRoot = this.hasRoot(mainView.divElement);
|
|
8746
|
+
const rect = this.getRectByDivElement(mainView.divElement);
|
|
8747
|
+
console.log(
|
|
8748
|
+
"[window-manager] bindMainView hasRoot" + hasRoot + JSON.stringify(rect) + window.outerHeight + window.outerWidth,
|
|
8749
|
+
(_b = (_a = window.visualViewport) == null ? void 0 : _a.width) != null ? _b : "null",
|
|
8750
|
+
(_d = (_c = window.visualViewport) == null ? void 0 : _c.height) != null ? _d : "null",
|
|
8751
|
+
(_f = (_e = window.visualViewport) == null ? void 0 : _e.offsetLeft) != null ? _f : "null",
|
|
8752
|
+
(_h = (_g = window.visualViewport) == null ? void 0 : _g.offsetTop) != null ? _h : "null"
|
|
8753
|
+
);
|
|
8754
|
+
}
|
|
8755
|
+
hasRoot(divElement) {
|
|
8756
|
+
let current = divElement;
|
|
8757
|
+
while (current) {
|
|
8758
|
+
if (current.parentElement === document.body) {
|
|
8759
|
+
return true;
|
|
8760
|
+
}
|
|
8761
|
+
current = current.parentElement;
|
|
8762
|
+
}
|
|
8763
|
+
return false;
|
|
8764
|
+
}
|
|
8765
|
+
getRectByDivElement(divElement) {
|
|
8766
|
+
const rect = divElement.getBoundingClientRect();
|
|
8767
|
+
return rect;
|
|
8695
8768
|
}
|
|
8696
8769
|
setMainViewFocusPath(scenePath) {
|
|
8697
8770
|
var _a;
|
|
@@ -8803,7 +8876,7 @@ class AppManager {
|
|
|
8803
8876
|
async _setMainViewScenePath(scenePath) {
|
|
8804
8877
|
const success = this.setMainViewFocusPath(scenePath);
|
|
8805
8878
|
if (success) {
|
|
8806
|
-
console.log("[window-manager] _setMainViewScenePath
|
|
8879
|
+
console.log("[window-manager] _setMainViewScenePath ", scenePath);
|
|
8807
8880
|
this.safeSetAttributes({ _mainScenePath: scenePath });
|
|
8808
8881
|
this.store.setMainViewFocusPath(this.mainView);
|
|
8809
8882
|
this.updateSceneIndex();
|
|
@@ -8831,7 +8904,7 @@ class AppManager {
|
|
|
8831
8904
|
}
|
|
8832
8905
|
}
|
|
8833
8906
|
dispatchSetMainViewScenePath(scenePath) {
|
|
8834
|
-
console.log("[window-manager] dispatchSetMainViewScenePath
|
|
8907
|
+
console.log("[window-manager] dispatchSetMainViewScenePath ", JSON.stringify(scenePath));
|
|
8835
8908
|
this.dispatchInternalEvent(Events.SetMainViewScenePath, { nextScenePath: scenePath });
|
|
8836
8909
|
callbacks$1.emit("mainViewScenePathChange", scenePath);
|
|
8837
8910
|
setScenePath(this.room, scenePath);
|
|
@@ -8914,17 +8987,20 @@ class ContainerResizeObserver {
|
|
|
8914
8987
|
return containerResizeObserver;
|
|
8915
8988
|
}
|
|
8916
8989
|
observePlaygroundSize(container, sizer, wrapper) {
|
|
8990
|
+
console.log(`[window-manager] observePlaygroundSize ${JSON.stringify(container.getBoundingClientRect())}, ${JSON.stringify(sizer.getBoundingClientRect())}, ${JSON.stringify(wrapper.getBoundingClientRect())}`);
|
|
8917
8991
|
this.updateSizer(container.getBoundingClientRect(), sizer, wrapper);
|
|
8918
8992
|
this.containerResizeObserver = new ResizeObserver$2((entries) => {
|
|
8919
8993
|
var _a;
|
|
8920
8994
|
const containerRect = (_a = entries[0]) == null ? void 0 : _a.contentRect;
|
|
8921
8995
|
if (containerRect) {
|
|
8922
8996
|
this.updateSizer(containerRect, sizer, wrapper);
|
|
8997
|
+
console.log(`[window-manager] containerResizeObserver ${JSON.stringify(containerRect)}`);
|
|
8923
8998
|
this.emitter.emit("playgroundSizeChange", containerRect);
|
|
8924
8999
|
}
|
|
8925
9000
|
});
|
|
8926
9001
|
this.disposer = this.emitter.on("containerSizeRatioUpdate", () => {
|
|
8927
9002
|
const containerRect = container.getBoundingClientRect();
|
|
9003
|
+
console.log(`[window-manager] containerSizeRatioUpdate ${JSON.stringify(containerRect)}`);
|
|
8928
9004
|
this.updateSizer(containerRect, sizer, wrapper);
|
|
8929
9005
|
this.emitter.emit("playgroundSizeChange", containerRect);
|
|
8930
9006
|
});
|
|
@@ -8941,6 +9017,8 @@ class ContainerResizeObserver {
|
|
|
8941
9017
|
}
|
|
8942
9018
|
wrapper.style.width = `${width}px`;
|
|
8943
9019
|
wrapper.style.height = `${height}px`;
|
|
9020
|
+
wrapper.style.backgroundColor = "green";
|
|
9021
|
+
console.log(`[window-manager] updateSizer ${JSON.stringify({ width, height })} ${wrapper.style.width} ${wrapper.style.height} ${JSON.stringify(wrapper.getBoundingClientRect())}`);
|
|
8944
9022
|
}
|
|
8945
9023
|
}
|
|
8946
9024
|
disconnect() {
|
|
@@ -9097,6 +9175,15 @@ const replaceRoomFunction = (room, manager) => {
|
|
|
9097
9175
|
return manager.canRedoSteps;
|
|
9098
9176
|
}
|
|
9099
9177
|
});
|
|
9178
|
+
const _scalePptToFit = room.scalePptToFit;
|
|
9179
|
+
room.scalePptToFit = (...args) => {
|
|
9180
|
+
var _a;
|
|
9181
|
+
_scalePptToFit.call(room, ...args);
|
|
9182
|
+
if ((_a = manager.appManager) == null ? void 0 : _a.mainViewProxy) {
|
|
9183
|
+
console.log("[window-manager] scalePptToFit " + JSON.stringify(args));
|
|
9184
|
+
manager.appManager.mainViewProxy.setCameraAndSize();
|
|
9185
|
+
}
|
|
9186
|
+
};
|
|
9100
9187
|
room.moveCamera = (camera) => manager.moveCamera(camera);
|
|
9101
9188
|
room.moveCameraToContain = (...args) => manager.moveCameraToContain(...args);
|
|
9102
9189
|
room.convertToPointInWorld = (...args) => manager.mainView.convertToPointInWorld(...args);
|
|
@@ -19687,15 +19774,36 @@ const reconnectRefresher = new ReconnectRefresher({ emitter: internalEmitter });
|
|
|
19687
19774
|
const _WindowManager = class extends InvisiblePlugin {
|
|
19688
19775
|
constructor(context) {
|
|
19689
19776
|
super(context);
|
|
19690
|
-
this.version = "1.0.13-test.
|
|
19777
|
+
this.version = "1.0.13-test.10";
|
|
19691
19778
|
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" } };
|
|
19692
19779
|
this.emitter = callbacks$1;
|
|
19693
19780
|
this.viewMode = ViewMode.Broadcaster;
|
|
19694
19781
|
this.isReplay = isPlayer(this.displayer);
|
|
19695
19782
|
this._cursorUIDs = [];
|
|
19696
19783
|
this.containerSizeRatio = _WindowManager.containerSizeRatio;
|
|
19784
|
+
this.visibleStateListener = () => {
|
|
19785
|
+
console.log("[window-manager] visibleStateListener isVisible:" + !document.hidden);
|
|
19786
|
+
};
|
|
19787
|
+
this.onMainViewScenePathChangeHandler = (scenePath) => {
|
|
19788
|
+
const mainViewElement = this.mainView.divElement;
|
|
19789
|
+
if (mainViewElement) {
|
|
19790
|
+
const backgroundImage = mainViewElement.querySelector(".background img");
|
|
19791
|
+
if (backgroundImage) {
|
|
19792
|
+
const backgroundImageRect = backgroundImage == null ? void 0 : backgroundImage.getBoundingClientRect();
|
|
19793
|
+
const backgroundImageCSS = window.getComputedStyle(backgroundImage);
|
|
19794
|
+
const backgroundImageVisible = (backgroundImageRect == null ? void 0 : backgroundImageRect.width) > 0 && (backgroundImageRect == null ? void 0 : backgroundImageRect.height) > 0 && backgroundImageCSS.display !== "none";
|
|
19795
|
+
console.log("[window-manager] backgroundImageVisible" + backgroundImageVisible);
|
|
19796
|
+
return;
|
|
19797
|
+
}
|
|
19798
|
+
console.log("[window-manager] onMainViewScenePathChange" + scenePath + "backgroundImageVisible is not found");
|
|
19799
|
+
}
|
|
19800
|
+
console.log("[window-manager] onMainViewScenePathChange" + scenePath + "mainViewElement is not found");
|
|
19801
|
+
};
|
|
19697
19802
|
_WindowManager.displayer = context.displayer;
|
|
19698
19803
|
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" } };
|
|
19804
|
+
this.visibleStateListener();
|
|
19805
|
+
document.addEventListener("visibilitychange", this.visibleStateListener);
|
|
19806
|
+
this.emitter.on("mainViewScenePathChange", this.onMainViewScenePathChangeHandler);
|
|
19699
19807
|
}
|
|
19700
19808
|
get Logger() {
|
|
19701
19809
|
return this._roomLogger;
|
|
@@ -19811,6 +19919,7 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
|
19811
19919
|
console.warn("[WindowManager]: indexedDB open failed");
|
|
19812
19920
|
console.log(error);
|
|
19813
19921
|
}
|
|
19922
|
+
manager.emitter.on("mainViewScenePathChange", manager.onMainViewScenePathChangeHandler);
|
|
19814
19923
|
return manager;
|
|
19815
19924
|
}
|
|
19816
19925
|
static initManager(room) {
|
|
@@ -20339,6 +20448,7 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
|
20339
20448
|
}, 500);
|
|
20340
20449
|
}
|
|
20341
20450
|
moveCameraToContain(rectangle) {
|
|
20451
|
+
console.log("[window-manager] moveCameraToContain" + JSON.stringify(rectangle));
|
|
20342
20452
|
this.mainView.moveCameraToContain(rectangle);
|
|
20343
20453
|
setTimeout(() => {
|
|
20344
20454
|
var _a;
|
|
@@ -20371,6 +20481,8 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
|
20371
20481
|
(_e = _WindowManager.playground.parentNode) == null ? void 0 : _e.removeChild(_WindowManager.playground);
|
|
20372
20482
|
}
|
|
20373
20483
|
_WindowManager.params = void 0;
|
|
20484
|
+
document.removeEventListener("visibilitychange", this.visibleStateListener);
|
|
20485
|
+
this.emitter.off("mainViewScenePathChange", this.onMainViewScenePathChangeHandler);
|
|
20374
20486
|
(_f = this._iframeBridge) == null ? void 0 : _f.destroy();
|
|
20375
20487
|
this._iframeBridge = void 0;
|
|
20376
20488
|
log("Destroyed");
|