@netless/window-manager 1.0.13-test.1 → 1.0.13-test.11
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 +7 -0
- package/dist/index.js +14 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +155 -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 +47 -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,15 @@ class MainViewProxy {
|
|
|
7826
7859
|
}, 50);
|
|
7827
7860
|
this._syncMainViewTimer = 0;
|
|
7828
7861
|
this.onCameraOrSizeUpdated = () => {
|
|
7862
|
+
console.log("[window-manager] onCameraOrSizeUpdated " + JSON.stringify(this.cameraState));
|
|
7863
|
+
if (this.mainView.divElement) {
|
|
7864
|
+
const children2 = this.mainView.divElement.children;
|
|
7865
|
+
console.log("[window-manager] onCameraOrSizeUpdated " + this.mainView.divElement.getBoundingClientRect());
|
|
7866
|
+
const child = children2[0];
|
|
7867
|
+
if (child) {
|
|
7868
|
+
console.log("[window-manager] child" + JSON.stringify(child.getBoundingClientRect()));
|
|
7869
|
+
}
|
|
7870
|
+
}
|
|
7829
7871
|
callbacks$1.emit("cameraStateChange", this.cameraState);
|
|
7830
7872
|
if (this.manager.room && this.manager.room.syncMainView) {
|
|
7831
7873
|
clearTimeout(this._syncMainViewTimer);
|
|
@@ -7835,6 +7877,7 @@ class MainViewProxy {
|
|
|
7835
7877
|
};
|
|
7836
7878
|
this.syncMainView = (room) => {
|
|
7837
7879
|
if (room.isWritable) {
|
|
7880
|
+
console.log("[window-manager] syncMainView ");
|
|
7838
7881
|
room.syncMainView(this.mainView);
|
|
7839
7882
|
}
|
|
7840
7883
|
};
|
|
@@ -7850,7 +7893,20 @@ class MainViewProxy {
|
|
|
7850
7893
|
this.startListenWritableChange();
|
|
7851
7894
|
});
|
|
7852
7895
|
const playgroundSizeChangeListener = () => {
|
|
7853
|
-
|
|
7896
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
7897
|
+
this.refreshScreenSizeIfStale();
|
|
7898
|
+
this.playgroundSizeChangeListenerLocalConsole.log(
|
|
7899
|
+
JSON.stringify(this.mainView.camera),
|
|
7900
|
+
JSON.stringify(this.mainView.size),
|
|
7901
|
+
JSON.stringify(this.mainViewSize),
|
|
7902
|
+
JSON.stringify(this.mainViewCamera),
|
|
7903
|
+
window.outerHeight,
|
|
7904
|
+
window.outerWidth,
|
|
7905
|
+
(_b = (_a = window.visualViewport) == null ? void 0 : _a.width) != null ? _b : "null",
|
|
7906
|
+
(_d = (_c = window.visualViewport) == null ? void 0 : _c.height) != null ? _d : "null",
|
|
7907
|
+
(_f = (_e = window.visualViewport) == null ? void 0 : _e.offsetLeft) != null ? _f : "null",
|
|
7908
|
+
(_h = (_g = window.visualViewport) == null ? void 0 : _g.offsetTop) != null ? _h : "null"
|
|
7909
|
+
);
|
|
7854
7910
|
this.sizeChangeHandler(this.mainViewSize);
|
|
7855
7911
|
};
|
|
7856
7912
|
this.sideEffectManager.add(() => {
|
|
@@ -7889,8 +7945,26 @@ class MainViewProxy {
|
|
|
7889
7945
|
this.moveCameraToContian(this.mainViewSize);
|
|
7890
7946
|
this.moveCamera(this.mainViewCamera);
|
|
7891
7947
|
}
|
|
7948
|
+
refreshScreenSizeIfStale() {
|
|
7949
|
+
var _a;
|
|
7950
|
+
const element2 = this.mainView.divElement;
|
|
7951
|
+
if (!element2)
|
|
7952
|
+
return;
|
|
7953
|
+
const { width, height } = element2.getBoundingClientRect();
|
|
7954
|
+
if (width <= 0 || height <= 0)
|
|
7955
|
+
return;
|
|
7956
|
+
const { width: viewWidth, height: viewHeight } = this.mainView.size;
|
|
7957
|
+
if (Math.abs(viewWidth - width) > 0.5 || Math.abs(viewHeight - height) > 0.5) {
|
|
7958
|
+
const resizableView = this.mainView;
|
|
7959
|
+
console.log("[window-manager] forceResizeScreen stale size" + JSON.stringify({
|
|
7960
|
+
viewSize: this.mainView.size,
|
|
7961
|
+
domSize: { width, height }
|
|
7962
|
+
}));
|
|
7963
|
+
(_a = resizableView.resizeScreen) == null ? void 0 : _a.call(resizableView);
|
|
7964
|
+
}
|
|
7965
|
+
}
|
|
7892
7966
|
start() {
|
|
7893
|
-
console.log("[window-manager] start
|
|
7967
|
+
console.log("[window-manager] start " + JSON.stringify(this.mainViewSize));
|
|
7894
7968
|
this.sizeChangeHandler(this.mainViewSize);
|
|
7895
7969
|
if (this.started)
|
|
7896
7970
|
return;
|
|
@@ -8107,6 +8181,7 @@ class AppManager {
|
|
|
8107
8181
|
var _a, _b;
|
|
8108
8182
|
const { scenePath } = params;
|
|
8109
8183
|
if (scenePath === ROOT_DIR) {
|
|
8184
|
+
console.log("[window-manager] onRemoveScenes ROOT_DIR");
|
|
8110
8185
|
await this.onRootDirRemoved();
|
|
8111
8186
|
this.dispatchInternalEvent(Events.RootDirRemoved);
|
|
8112
8187
|
return;
|
|
@@ -8119,6 +8194,7 @@ class AppManager {
|
|
|
8119
8194
|
sceneName = (_b = this.callbacksNode) == null ? void 0 : _b.scenes[nextIndex];
|
|
8120
8195
|
}
|
|
8121
8196
|
if (sceneName) {
|
|
8197
|
+
console.log(`[window-manager] onRemoveScenes setMainViewScenePath${ROOT_DIR}${sceneName}`);
|
|
8122
8198
|
this.setMainViewScenePath(`${ROOT_DIR}${sceneName}`);
|
|
8123
8199
|
}
|
|
8124
8200
|
await this.setMainViewSceneIndex(nextIndex);
|
|
@@ -8416,7 +8492,7 @@ class AppManager {
|
|
|
8416
8492
|
const pageName = scenePath.replace(sceneDir, "").replace("/", "");
|
|
8417
8493
|
const index2 = scenes.findIndex((scene) => scene.name === pageName);
|
|
8418
8494
|
if (isInteger(index2) && index2 >= 0) {
|
|
8419
|
-
console.log("[window-manager] updateSceneIndex
|
|
8495
|
+
console.log("[window-manager] updateSceneIndex ", index2);
|
|
8420
8496
|
this.safeSetAttributes({ _mainSceneIndex: index2 });
|
|
8421
8497
|
}
|
|
8422
8498
|
}
|
|
@@ -8684,6 +8760,7 @@ class AppManager {
|
|
|
8684
8760
|
(_a = this.boxManager) == null ? void 0 : _a.setMinimized(Boolean(this.store.getMinimized()));
|
|
8685
8761
|
}
|
|
8686
8762
|
bindMainView(divElement, disableCameraTransform) {
|
|
8763
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
8687
8764
|
const mainView = this.mainViewProxy.view;
|
|
8688
8765
|
mainView.disableCameraTransform = disableCameraTransform;
|
|
8689
8766
|
mainView.divElement = divElement;
|
|
@@ -8692,6 +8769,29 @@ class AppManager {
|
|
|
8692
8769
|
}
|
|
8693
8770
|
internalEmitter.emit("mainViewMounted");
|
|
8694
8771
|
callbacks$1.emit("onMainViewMounted", mainView);
|
|
8772
|
+
const hasRoot = this.hasRoot(mainView.divElement);
|
|
8773
|
+
const rect = this.getRectByDivElement(mainView.divElement);
|
|
8774
|
+
console.log(
|
|
8775
|
+
"[window-manager] bindMainView hasRoot" + hasRoot + JSON.stringify(rect) + window.outerHeight + window.outerWidth,
|
|
8776
|
+
(_b = (_a = window.visualViewport) == null ? void 0 : _a.width) != null ? _b : "null",
|
|
8777
|
+
(_d = (_c = window.visualViewport) == null ? void 0 : _c.height) != null ? _d : "null",
|
|
8778
|
+
(_f = (_e = window.visualViewport) == null ? void 0 : _e.offsetLeft) != null ? _f : "null",
|
|
8779
|
+
(_h = (_g = window.visualViewport) == null ? void 0 : _g.offsetTop) != null ? _h : "null"
|
|
8780
|
+
);
|
|
8781
|
+
}
|
|
8782
|
+
hasRoot(divElement) {
|
|
8783
|
+
let current = divElement;
|
|
8784
|
+
while (current) {
|
|
8785
|
+
if (current.parentElement === document.body) {
|
|
8786
|
+
return true;
|
|
8787
|
+
}
|
|
8788
|
+
current = current.parentElement;
|
|
8789
|
+
}
|
|
8790
|
+
return false;
|
|
8791
|
+
}
|
|
8792
|
+
getRectByDivElement(divElement) {
|
|
8793
|
+
const rect = divElement.getBoundingClientRect();
|
|
8794
|
+
return rect;
|
|
8695
8795
|
}
|
|
8696
8796
|
setMainViewFocusPath(scenePath) {
|
|
8697
8797
|
var _a;
|
|
@@ -8803,7 +8903,7 @@ class AppManager {
|
|
|
8803
8903
|
async _setMainViewScenePath(scenePath) {
|
|
8804
8904
|
const success = this.setMainViewFocusPath(scenePath);
|
|
8805
8905
|
if (success) {
|
|
8806
|
-
console.log("[window-manager] _setMainViewScenePath
|
|
8906
|
+
console.log("[window-manager] _setMainViewScenePath ", scenePath);
|
|
8807
8907
|
this.safeSetAttributes({ _mainScenePath: scenePath });
|
|
8808
8908
|
this.store.setMainViewFocusPath(this.mainView);
|
|
8809
8909
|
this.updateSceneIndex();
|
|
@@ -8831,7 +8931,7 @@ class AppManager {
|
|
|
8831
8931
|
}
|
|
8832
8932
|
}
|
|
8833
8933
|
dispatchSetMainViewScenePath(scenePath) {
|
|
8834
|
-
console.log("[window-manager] dispatchSetMainViewScenePath
|
|
8934
|
+
console.log("[window-manager] dispatchSetMainViewScenePath ", JSON.stringify(scenePath));
|
|
8835
8935
|
this.dispatchInternalEvent(Events.SetMainViewScenePath, { nextScenePath: scenePath });
|
|
8836
8936
|
callbacks$1.emit("mainViewScenePathChange", scenePath);
|
|
8837
8937
|
setScenePath(this.room, scenePath);
|
|
@@ -8914,17 +9014,20 @@ class ContainerResizeObserver {
|
|
|
8914
9014
|
return containerResizeObserver;
|
|
8915
9015
|
}
|
|
8916
9016
|
observePlaygroundSize(container, sizer, wrapper) {
|
|
9017
|
+
console.log(`[window-manager] observePlaygroundSize ${JSON.stringify(container.getBoundingClientRect())}, ${JSON.stringify(sizer.getBoundingClientRect())}, ${JSON.stringify(wrapper.getBoundingClientRect())}`);
|
|
8917
9018
|
this.updateSizer(container.getBoundingClientRect(), sizer, wrapper);
|
|
8918
9019
|
this.containerResizeObserver = new ResizeObserver$2((entries) => {
|
|
8919
9020
|
var _a;
|
|
8920
9021
|
const containerRect = (_a = entries[0]) == null ? void 0 : _a.contentRect;
|
|
8921
9022
|
if (containerRect) {
|
|
8922
9023
|
this.updateSizer(containerRect, sizer, wrapper);
|
|
9024
|
+
console.log(`[window-manager] containerResizeObserver ${JSON.stringify(containerRect)}`);
|
|
8923
9025
|
this.emitter.emit("playgroundSizeChange", containerRect);
|
|
8924
9026
|
}
|
|
8925
9027
|
});
|
|
8926
9028
|
this.disposer = this.emitter.on("containerSizeRatioUpdate", () => {
|
|
8927
9029
|
const containerRect = container.getBoundingClientRect();
|
|
9030
|
+
console.log(`[window-manager] containerSizeRatioUpdate ${JSON.stringify(containerRect)}`);
|
|
8928
9031
|
this.updateSizer(containerRect, sizer, wrapper);
|
|
8929
9032
|
this.emitter.emit("playgroundSizeChange", containerRect);
|
|
8930
9033
|
});
|
|
@@ -8941,6 +9044,8 @@ class ContainerResizeObserver {
|
|
|
8941
9044
|
}
|
|
8942
9045
|
wrapper.style.width = `${width}px`;
|
|
8943
9046
|
wrapper.style.height = `${height}px`;
|
|
9047
|
+
wrapper.style.backgroundColor = "green";
|
|
9048
|
+
console.log(`[window-manager] updateSizer ${JSON.stringify({ width, height })} ${wrapper.style.width} ${wrapper.style.height} ${JSON.stringify(wrapper.getBoundingClientRect())}`);
|
|
8944
9049
|
}
|
|
8945
9050
|
}
|
|
8946
9051
|
disconnect() {
|
|
@@ -9097,6 +9202,15 @@ const replaceRoomFunction = (room, manager) => {
|
|
|
9097
9202
|
return manager.canRedoSteps;
|
|
9098
9203
|
}
|
|
9099
9204
|
});
|
|
9205
|
+
const _scalePptToFit = room.scalePptToFit;
|
|
9206
|
+
room.scalePptToFit = (...args) => {
|
|
9207
|
+
var _a;
|
|
9208
|
+
_scalePptToFit.call(room, ...args);
|
|
9209
|
+
if ((_a = manager.appManager) == null ? void 0 : _a.mainViewProxy) {
|
|
9210
|
+
console.log("[window-manager] scalePptToFit " + JSON.stringify(args));
|
|
9211
|
+
manager.appManager.mainViewProxy.setCameraAndSize();
|
|
9212
|
+
}
|
|
9213
|
+
};
|
|
9100
9214
|
room.moveCamera = (camera) => manager.moveCamera(camera);
|
|
9101
9215
|
room.moveCameraToContain = (...args) => manager.moveCameraToContain(...args);
|
|
9102
9216
|
room.convertToPointInWorld = (...args) => manager.mainView.convertToPointInWorld(...args);
|
|
@@ -19687,15 +19801,36 @@ const reconnectRefresher = new ReconnectRefresher({ emitter: internalEmitter });
|
|
|
19687
19801
|
const _WindowManager = class extends InvisiblePlugin {
|
|
19688
19802
|
constructor(context) {
|
|
19689
19803
|
super(context);
|
|
19690
|
-
this.version = "1.0.13-test.
|
|
19804
|
+
this.version = "1.0.13-test.11";
|
|
19691
19805
|
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
19806
|
this.emitter = callbacks$1;
|
|
19693
19807
|
this.viewMode = ViewMode.Broadcaster;
|
|
19694
19808
|
this.isReplay = isPlayer(this.displayer);
|
|
19695
19809
|
this._cursorUIDs = [];
|
|
19696
19810
|
this.containerSizeRatio = _WindowManager.containerSizeRatio;
|
|
19811
|
+
this.visibleStateListener = () => {
|
|
19812
|
+
console.log("[window-manager] visibleStateListener isVisible:" + !document.hidden);
|
|
19813
|
+
};
|
|
19814
|
+
this.onMainViewScenePathChangeHandler = (scenePath) => {
|
|
19815
|
+
const mainViewElement = this.mainView.divElement;
|
|
19816
|
+
if (mainViewElement) {
|
|
19817
|
+
const backgroundImage = mainViewElement.querySelector(".background img");
|
|
19818
|
+
if (backgroundImage) {
|
|
19819
|
+
const backgroundImageRect = backgroundImage == null ? void 0 : backgroundImage.getBoundingClientRect();
|
|
19820
|
+
const backgroundImageCSS = window.getComputedStyle(backgroundImage);
|
|
19821
|
+
const backgroundImageVisible = (backgroundImageRect == null ? void 0 : backgroundImageRect.width) > 0 && (backgroundImageRect == null ? void 0 : backgroundImageRect.height) > 0 && backgroundImageCSS.display !== "none";
|
|
19822
|
+
console.log("[window-manager] backgroundImageVisible" + backgroundImageVisible);
|
|
19823
|
+
return;
|
|
19824
|
+
}
|
|
19825
|
+
console.log("[window-manager] onMainViewScenePathChange" + scenePath + "backgroundImageVisible is not found");
|
|
19826
|
+
}
|
|
19827
|
+
console.log("[window-manager] onMainViewScenePathChange" + scenePath + "mainViewElement is not found");
|
|
19828
|
+
};
|
|
19697
19829
|
_WindowManager.displayer = context.displayer;
|
|
19698
19830
|
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" } };
|
|
19831
|
+
this.visibleStateListener();
|
|
19832
|
+
document.addEventListener("visibilitychange", this.visibleStateListener);
|
|
19833
|
+
this.emitter.on("mainViewScenePathChange", this.onMainViewScenePathChangeHandler);
|
|
19699
19834
|
}
|
|
19700
19835
|
get Logger() {
|
|
19701
19836
|
return this._roomLogger;
|
|
@@ -19811,6 +19946,7 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
|
19811
19946
|
console.warn("[WindowManager]: indexedDB open failed");
|
|
19812
19947
|
console.log(error);
|
|
19813
19948
|
}
|
|
19949
|
+
manager.emitter.on("mainViewScenePathChange", manager.onMainViewScenePathChangeHandler);
|
|
19814
19950
|
return manager;
|
|
19815
19951
|
}
|
|
19816
19952
|
static initManager(room) {
|
|
@@ -20339,6 +20475,7 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
|
20339
20475
|
}, 500);
|
|
20340
20476
|
}
|
|
20341
20477
|
moveCameraToContain(rectangle) {
|
|
20478
|
+
console.log("[window-manager] moveCameraToContain" + JSON.stringify(rectangle));
|
|
20342
20479
|
this.mainView.moveCameraToContain(rectangle);
|
|
20343
20480
|
setTimeout(() => {
|
|
20344
20481
|
var _a;
|
|
@@ -20371,6 +20508,8 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
|
20371
20508
|
(_e = _WindowManager.playground.parentNode) == null ? void 0 : _e.removeChild(_WindowManager.playground);
|
|
20372
20509
|
}
|
|
20373
20510
|
_WindowManager.params = void 0;
|
|
20511
|
+
document.removeEventListener("visibilitychange", this.visibleStateListener);
|
|
20512
|
+
this.emitter.off("mainViewScenePathChange", this.onMainViewScenePathChangeHandler);
|
|
20374
20513
|
(_f = this._iframeBridge) == null ? void 0 : _f.destroy();
|
|
20375
20514
|
this._iframeBridge = void 0;
|
|
20376
20515
|
log("Destroyed");
|