@netless/window-manager 1.0.13-beta.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 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/AppListener.ts +1 -19
- package/src/AppManager.ts +31 -0
- package/src/AttributesDelegate.ts +7 -0
- package/src/BoxManager.ts +1 -0
- package/src/ContainerResizeObserver.ts +5 -0
- package/src/Utils/Common.ts +1 -0
- package/src/Utils/RoomHacker.ts +8 -1
- package/src/Utils/log.ts +37 -0
- package/src/View/MainView.ts +20 -0
- package/src/index.ts +29 -3
package/dist/index.mjs
CHANGED
|
@@ -352,6 +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 ", nextScenePath);
|
|
355
356
|
room.setScenePath(nextScenePath);
|
|
356
357
|
}
|
|
357
358
|
}
|
|
@@ -463,6 +464,7 @@ class AppListeners {
|
|
|
463
464
|
break;
|
|
464
465
|
}
|
|
465
466
|
case Events.SetMainViewScenePath: {
|
|
467
|
+
console.log("[window-manager] mainMagixEventListener " + JSON.stringify(data.payload));
|
|
466
468
|
this.setMainViewScenePathHandler(data.payload);
|
|
467
469
|
break;
|
|
468
470
|
}
|
|
@@ -5624,6 +5626,7 @@ class BoxManager {
|
|
|
5624
5626
|
const rect = (_a = this.mainView.divElement) == null ? void 0 : _a.getBoundingClientRect();
|
|
5625
5627
|
if (rect && rect.width > 0 && rect.height > 0) {
|
|
5626
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);
|
|
5627
5630
|
this.teleBoxManager.setContainerRect(containerRect);
|
|
5628
5631
|
this.context.notifyContainerRectUpdate(this.teleBoxManager.containerRect);
|
|
5629
5632
|
}
|
|
@@ -5695,6 +5698,35 @@ const log = (...args) => {
|
|
|
5695
5698
|
console.log(`[WindowManager]:`, ...args);
|
|
5696
5699
|
}
|
|
5697
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
|
+
}
|
|
5698
5730
|
const setupWrapper = (root) => {
|
|
5699
5731
|
const playground = document.createElement("div");
|
|
5700
5732
|
playground.className = "netless-window-manager-playground";
|
|
@@ -7002,6 +7034,7 @@ var Fields = /* @__PURE__ */ ((Fields2) => {
|
|
|
7002
7034
|
class AttributesDelegate {
|
|
7003
7035
|
constructor(context) {
|
|
7004
7036
|
this.context = context;
|
|
7037
|
+
this.setMainViewCameraConsole = new LocalConsole("setMainViewCamera", 50);
|
|
7005
7038
|
this.setAppFocus = (appId, focus) => {
|
|
7006
7039
|
if (focus) {
|
|
7007
7040
|
this.context.safeSetAttributes({ ["focus"]: appId });
|
|
@@ -7127,9 +7160,11 @@ class AttributesDelegate {
|
|
|
7127
7160
|
return this.attributes["boxState"];
|
|
7128
7161
|
}
|
|
7129
7162
|
setMainViewScenePath(scenePath) {
|
|
7163
|
+
console.log("[window-manager] setMainViewScenePath ", scenePath);
|
|
7130
7164
|
this.context.safeSetAttributes({ _mainScenePath: scenePath });
|
|
7131
7165
|
}
|
|
7132
7166
|
setMainViewSceneIndex(index2) {
|
|
7167
|
+
console.log("[window-manager] setMainViewSceneIndex ", index2);
|
|
7133
7168
|
this.context.safeSetAttributes({ _mainSceneIndex: index2 });
|
|
7134
7169
|
}
|
|
7135
7170
|
getMainViewCamera() {
|
|
@@ -7139,16 +7174,19 @@ class AttributesDelegate {
|
|
|
7139
7174
|
return get(this.attributes, ["mainViewSize"]);
|
|
7140
7175
|
}
|
|
7141
7176
|
setMainViewCamera(camera) {
|
|
7177
|
+
this.setMainViewCameraConsole.log(JSON.stringify(camera));
|
|
7142
7178
|
this.context.safeSetAttributes({ ["mainViewCamera"]: { ...camera } });
|
|
7143
7179
|
}
|
|
7144
7180
|
setMainViewSize(size2) {
|
|
7145
7181
|
if (size2.width === 0 || size2.height === 0)
|
|
7146
7182
|
return;
|
|
7183
|
+
console.log("[window-manager] setMainViewSize ", JSON.stringify(size2));
|
|
7147
7184
|
this.context.safeSetAttributes({ ["mainViewSize"]: { ...size2 } });
|
|
7148
7185
|
}
|
|
7149
7186
|
setMainViewCameraAndSize(camera, size2) {
|
|
7150
7187
|
if (size2.width === 0 || size2.height === 0)
|
|
7151
7188
|
return;
|
|
7189
|
+
console.log("[window-manager] setMainViewCameraAndSize ", JSON.stringify(camera), JSON.stringify(size2));
|
|
7152
7190
|
this.context.safeSetAttributes({
|
|
7153
7191
|
["mainViewCamera"]: { ...camera },
|
|
7154
7192
|
["mainViewSize"]: { ...size2 }
|
|
@@ -7746,6 +7784,7 @@ const setDefaultCameraBound = (view) => {
|
|
|
7746
7784
|
minContentMode: () => 0.1
|
|
7747
7785
|
});
|
|
7748
7786
|
};
|
|
7787
|
+
window.___local_log = window.___local_log || /* @__PURE__ */ new Set();
|
|
7749
7788
|
class MainViewProxy {
|
|
7750
7789
|
constructor(manager) {
|
|
7751
7790
|
this.manager = manager;
|
|
@@ -7755,6 +7794,7 @@ class MainViewProxy {
|
|
|
7755
7794
|
this.store = this.manager.store;
|
|
7756
7795
|
this.viewMode = this.manager.windowManger.viewMode;
|
|
7757
7796
|
this.sideEffectManager = new o$2();
|
|
7797
|
+
this.playgroundSizeChangeListenerLocalConsole = new LocalConsole("playgroundSizeChangeListener", 30);
|
|
7758
7798
|
this.syncCamera = () => {
|
|
7759
7799
|
if (!this.polling || this.viewMode !== ViewMode.Broadcaster)
|
|
7760
7800
|
return;
|
|
@@ -7782,6 +7822,7 @@ class MainViewProxy {
|
|
|
7782
7822
|
() => this.mainViewCamera,
|
|
7783
7823
|
(camera) => {
|
|
7784
7824
|
if (camera && camera.id !== this.manager.uid) {
|
|
7825
|
+
console.log("[window-manager] cameraReaction " + JSON.stringify(camera) + JSON.stringify(this.mainViewSize));
|
|
7785
7826
|
this.moveCameraToContian(this.mainViewSize);
|
|
7786
7827
|
this.moveCamera(camera);
|
|
7787
7828
|
}
|
|
@@ -7793,11 +7834,13 @@ class MainViewProxy {
|
|
|
7793
7834
|
if (size2) {
|
|
7794
7835
|
this.moveCameraToContian(size2);
|
|
7795
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));
|
|
7796
7838
|
}
|
|
7797
7839
|
this.ensureMainViewSize();
|
|
7798
7840
|
}, 30);
|
|
7799
7841
|
this.onUpdateContainerSizeRatio = () => {
|
|
7800
7842
|
const size2 = this.store.getMainViewSize();
|
|
7843
|
+
console.log("[window-manager] onUpdateContainerSizeRatio " + JSON.stringify(size2));
|
|
7801
7844
|
this.sizeChangeHandler(size2);
|
|
7802
7845
|
};
|
|
7803
7846
|
this.onCameraUpdatedByDevice = (camera) => {
|
|
@@ -7816,6 +7859,7 @@ class MainViewProxy {
|
|
|
7816
7859
|
}, 50);
|
|
7817
7860
|
this._syncMainViewTimer = 0;
|
|
7818
7861
|
this.onCameraOrSizeUpdated = () => {
|
|
7862
|
+
console.log("[window-manager] onCameraOrSizeUpdated " + JSON.stringify(this.cameraState));
|
|
7819
7863
|
callbacks$1.emit("cameraStateChange", this.cameraState);
|
|
7820
7864
|
if (this.manager.room && this.manager.room.syncMainView) {
|
|
7821
7865
|
clearTimeout(this._syncMainViewTimer);
|
|
@@ -7825,6 +7869,7 @@ class MainViewProxy {
|
|
|
7825
7869
|
};
|
|
7826
7870
|
this.syncMainView = (room) => {
|
|
7827
7871
|
if (room.isWritable) {
|
|
7872
|
+
console.log("[window-manager] syncMainView ");
|
|
7828
7873
|
room.syncMainView(this.mainView);
|
|
7829
7874
|
}
|
|
7830
7875
|
};
|
|
@@ -7840,6 +7885,19 @@ class MainViewProxy {
|
|
|
7840
7885
|
this.startListenWritableChange();
|
|
7841
7886
|
});
|
|
7842
7887
|
const playgroundSizeChangeListener = () => {
|
|
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
|
+
);
|
|
7843
7901
|
this.sizeChangeHandler(this.mainViewSize);
|
|
7844
7902
|
};
|
|
7845
7903
|
this.sideEffectManager.add(() => {
|
|
@@ -7879,6 +7937,7 @@ class MainViewProxy {
|
|
|
7879
7937
|
this.moveCamera(this.mainViewCamera);
|
|
7880
7938
|
}
|
|
7881
7939
|
start() {
|
|
7940
|
+
console.log("[window-manager] start " + JSON.stringify(this.mainViewSize));
|
|
7882
7941
|
this.sizeChangeHandler(this.mainViewSize);
|
|
7883
7942
|
if (this.started)
|
|
7884
7943
|
return;
|
|
@@ -8095,6 +8154,7 @@ class AppManager {
|
|
|
8095
8154
|
var _a, _b;
|
|
8096
8155
|
const { scenePath } = params;
|
|
8097
8156
|
if (scenePath === ROOT_DIR) {
|
|
8157
|
+
console.log("[window-manager] onRemoveScenes ROOT_DIR");
|
|
8098
8158
|
await this.onRootDirRemoved();
|
|
8099
8159
|
this.dispatchInternalEvent(Events.RootDirRemoved);
|
|
8100
8160
|
return;
|
|
@@ -8107,6 +8167,7 @@ class AppManager {
|
|
|
8107
8167
|
sceneName = (_b = this.callbacksNode) == null ? void 0 : _b.scenes[nextIndex];
|
|
8108
8168
|
}
|
|
8109
8169
|
if (sceneName) {
|
|
8170
|
+
console.log(`[window-manager] onRemoveScenes setMainViewScenePath${ROOT_DIR}${sceneName}`);
|
|
8110
8171
|
this.setMainViewScenePath(`${ROOT_DIR}${sceneName}`);
|
|
8111
8172
|
}
|
|
8112
8173
|
await this.setMainViewSceneIndex(nextIndex);
|
|
@@ -8404,6 +8465,7 @@ class AppManager {
|
|
|
8404
8465
|
const pageName = scenePath.replace(sceneDir, "").replace("/", "");
|
|
8405
8466
|
const index2 = scenes.findIndex((scene) => scene.name === pageName);
|
|
8406
8467
|
if (isInteger(index2) && index2 >= 0) {
|
|
8468
|
+
console.log("[window-manager] updateSceneIndex ", index2);
|
|
8407
8469
|
this.safeSetAttributes({ _mainSceneIndex: index2 });
|
|
8408
8470
|
}
|
|
8409
8471
|
}
|
|
@@ -8671,6 +8733,7 @@ class AppManager {
|
|
|
8671
8733
|
(_a = this.boxManager) == null ? void 0 : _a.setMinimized(Boolean(this.store.getMinimized()));
|
|
8672
8734
|
}
|
|
8673
8735
|
bindMainView(divElement, disableCameraTransform) {
|
|
8736
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
8674
8737
|
const mainView = this.mainViewProxy.view;
|
|
8675
8738
|
mainView.disableCameraTransform = disableCameraTransform;
|
|
8676
8739
|
mainView.divElement = divElement;
|
|
@@ -8679,6 +8742,29 @@ class AppManager {
|
|
|
8679
8742
|
}
|
|
8680
8743
|
internalEmitter.emit("mainViewMounted");
|
|
8681
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;
|
|
8682
8768
|
}
|
|
8683
8769
|
setMainViewFocusPath(scenePath) {
|
|
8684
8770
|
var _a;
|
|
@@ -8790,6 +8876,7 @@ class AppManager {
|
|
|
8790
8876
|
async _setMainViewScenePath(scenePath) {
|
|
8791
8877
|
const success = this.setMainViewFocusPath(scenePath);
|
|
8792
8878
|
if (success) {
|
|
8879
|
+
console.log("[window-manager] _setMainViewScenePath ", scenePath);
|
|
8793
8880
|
this.safeSetAttributes({ _mainScenePath: scenePath });
|
|
8794
8881
|
this.store.setMainViewFocusPath(this.mainView);
|
|
8795
8882
|
this.updateSceneIndex();
|
|
@@ -8817,6 +8904,7 @@ class AppManager {
|
|
|
8817
8904
|
}
|
|
8818
8905
|
}
|
|
8819
8906
|
dispatchSetMainViewScenePath(scenePath) {
|
|
8907
|
+
console.log("[window-manager] dispatchSetMainViewScenePath ", JSON.stringify(scenePath));
|
|
8820
8908
|
this.dispatchInternalEvent(Events.SetMainViewScenePath, { nextScenePath: scenePath });
|
|
8821
8909
|
callbacks$1.emit("mainViewScenePathChange", scenePath);
|
|
8822
8910
|
setScenePath(this.room, scenePath);
|
|
@@ -8899,17 +8987,20 @@ class ContainerResizeObserver {
|
|
|
8899
8987
|
return containerResizeObserver;
|
|
8900
8988
|
}
|
|
8901
8989
|
observePlaygroundSize(container, sizer, wrapper) {
|
|
8990
|
+
console.log(`[window-manager] observePlaygroundSize ${JSON.stringify(container.getBoundingClientRect())}, ${JSON.stringify(sizer.getBoundingClientRect())}, ${JSON.stringify(wrapper.getBoundingClientRect())}`);
|
|
8902
8991
|
this.updateSizer(container.getBoundingClientRect(), sizer, wrapper);
|
|
8903
8992
|
this.containerResizeObserver = new ResizeObserver$2((entries) => {
|
|
8904
8993
|
var _a;
|
|
8905
8994
|
const containerRect = (_a = entries[0]) == null ? void 0 : _a.contentRect;
|
|
8906
8995
|
if (containerRect) {
|
|
8907
8996
|
this.updateSizer(containerRect, sizer, wrapper);
|
|
8997
|
+
console.log(`[window-manager] containerResizeObserver ${JSON.stringify(containerRect)}`);
|
|
8908
8998
|
this.emitter.emit("playgroundSizeChange", containerRect);
|
|
8909
8999
|
}
|
|
8910
9000
|
});
|
|
8911
9001
|
this.disposer = this.emitter.on("containerSizeRatioUpdate", () => {
|
|
8912
9002
|
const containerRect = container.getBoundingClientRect();
|
|
9003
|
+
console.log(`[window-manager] containerSizeRatioUpdate ${JSON.stringify(containerRect)}`);
|
|
8913
9004
|
this.updateSizer(containerRect, sizer, wrapper);
|
|
8914
9005
|
this.emitter.emit("playgroundSizeChange", containerRect);
|
|
8915
9006
|
});
|
|
@@ -8926,6 +9017,8 @@ class ContainerResizeObserver {
|
|
|
8926
9017
|
}
|
|
8927
9018
|
wrapper.style.width = `${width}px`;
|
|
8928
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())}`);
|
|
8929
9022
|
}
|
|
8930
9023
|
}
|
|
8931
9024
|
disconnect() {
|
|
@@ -9082,6 +9175,15 @@ const replaceRoomFunction = (room, manager) => {
|
|
|
9082
9175
|
return manager.canRedoSteps;
|
|
9083
9176
|
}
|
|
9084
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
|
+
};
|
|
9085
9187
|
room.moveCamera = (camera) => manager.moveCamera(camera);
|
|
9086
9188
|
room.moveCameraToContain = (...args) => manager.moveCameraToContain(...args);
|
|
9087
9189
|
room.convertToPointInWorld = (...args) => manager.mainView.convertToPointInWorld(...args);
|
|
@@ -19672,15 +19774,36 @@ const reconnectRefresher = new ReconnectRefresher({ emitter: internalEmitter });
|
|
|
19672
19774
|
const _WindowManager = class extends InvisiblePlugin {
|
|
19673
19775
|
constructor(context) {
|
|
19674
19776
|
super(context);
|
|
19675
|
-
this.version = "1.0.13-
|
|
19777
|
+
this.version = "1.0.13-test.10";
|
|
19676
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" } };
|
|
19677
19779
|
this.emitter = callbacks$1;
|
|
19678
19780
|
this.viewMode = ViewMode.Broadcaster;
|
|
19679
19781
|
this.isReplay = isPlayer(this.displayer);
|
|
19680
19782
|
this._cursorUIDs = [];
|
|
19681
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
|
+
};
|
|
19682
19802
|
_WindowManager.displayer = context.displayer;
|
|
19683
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);
|
|
19684
19807
|
}
|
|
19685
19808
|
get Logger() {
|
|
19686
19809
|
return this._roomLogger;
|
|
@@ -19796,6 +19919,7 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
|
19796
19919
|
console.warn("[WindowManager]: indexedDB open failed");
|
|
19797
19920
|
console.log(error);
|
|
19798
19921
|
}
|
|
19922
|
+
manager.emitter.on("mainViewScenePathChange", manager.onMainViewScenePathChangeHandler);
|
|
19799
19923
|
return manager;
|
|
19800
19924
|
}
|
|
19801
19925
|
static initManager(room) {
|
|
@@ -20324,6 +20448,7 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
|
20324
20448
|
}, 500);
|
|
20325
20449
|
}
|
|
20326
20450
|
moveCameraToContain(rectangle) {
|
|
20451
|
+
console.log("[window-manager] moveCameraToContain" + JSON.stringify(rectangle));
|
|
20327
20452
|
this.mainView.moveCameraToContain(rectangle);
|
|
20328
20453
|
setTimeout(() => {
|
|
20329
20454
|
var _a;
|
|
@@ -20356,6 +20481,8 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
|
20356
20481
|
(_e = _WindowManager.playground.parentNode) == null ? void 0 : _e.removeChild(_WindowManager.playground);
|
|
20357
20482
|
}
|
|
20358
20483
|
_WindowManager.params = void 0;
|
|
20484
|
+
document.removeEventListener("visibilitychange", this.visibleStateListener);
|
|
20485
|
+
this.emitter.off("mainViewScenePathChange", this.onMainViewScenePathChangeHandler);
|
|
20359
20486
|
(_f = this._iframeBridge) == null ? void 0 : _f.destroy();
|
|
20360
20487
|
this._iframeBridge = void 0;
|
|
20361
20488
|
log("Destroyed");
|