@netless/window-manager 1.0.13-test.11 → 1.0.13-test.12
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 +4 -0
- package/dist/index.js +14 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +49 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/View/MainView.ts +50 -0
package/dist/index.mjs
CHANGED
|
@@ -7857,6 +7857,36 @@ class MainViewProxy {
|
|
|
7857
7857
|
this.setMainViewSize = debounce((size2) => {
|
|
7858
7858
|
this.store.setMainViewSize({ ...size2, id: this.manager.uid });
|
|
7859
7859
|
}, 50);
|
|
7860
|
+
this.onResize = (entries) => {
|
|
7861
|
+
const entry = entries[0];
|
|
7862
|
+
if (!entry)
|
|
7863
|
+
return;
|
|
7864
|
+
const target = entry.target;
|
|
7865
|
+
const child = target.children[0];
|
|
7866
|
+
console.log("[window-manager] mainViewResizeObserver " + JSON.stringify({
|
|
7867
|
+
contentRect: {
|
|
7868
|
+
width: entry.contentRect.width,
|
|
7869
|
+
height: entry.contentRect.height
|
|
7870
|
+
},
|
|
7871
|
+
client: {
|
|
7872
|
+
width: target.clientWidth,
|
|
7873
|
+
height: target.clientHeight
|
|
7874
|
+
},
|
|
7875
|
+
offset: {
|
|
7876
|
+
width: target.offsetWidth,
|
|
7877
|
+
height: target.offsetHeight
|
|
7878
|
+
},
|
|
7879
|
+
rect: {
|
|
7880
|
+
width: target.getBoundingClientRect().width,
|
|
7881
|
+
height: target.getBoundingClientRect().height
|
|
7882
|
+
},
|
|
7883
|
+
childRect: child ? {
|
|
7884
|
+
width: child.getBoundingClientRect().width,
|
|
7885
|
+
height: child.getBoundingClientRect().height
|
|
7886
|
+
} : null,
|
|
7887
|
+
viewSize: this.mainView.size
|
|
7888
|
+
}));
|
|
7889
|
+
};
|
|
7860
7890
|
this._syncMainViewTimer = 0;
|
|
7861
7891
|
this.onCameraOrSizeUpdated = () => {
|
|
7862
7892
|
console.log("[window-manager] onCameraOrSizeUpdated " + JSON.stringify(this.cameraState));
|
|
@@ -7887,6 +7917,7 @@ class MainViewProxy {
|
|
|
7887
7917
|
this.mainView = this.createMainView();
|
|
7888
7918
|
this.moveCameraSizeByAttributes();
|
|
7889
7919
|
internalEmitter.once("mainViewMounted").then(() => {
|
|
7920
|
+
this.observeMainViewDivElement();
|
|
7890
7921
|
this.addMainViewListener();
|
|
7891
7922
|
this.start();
|
|
7892
7923
|
this.ensureCameraAndSize();
|
|
@@ -8014,9 +8045,11 @@ class MainViewProxy {
|
|
|
8014
8045
|
this.mainView.release();
|
|
8015
8046
|
}
|
|
8016
8047
|
this.removeMainViewListener();
|
|
8048
|
+
this.disconnectMainViewResizeObserver();
|
|
8017
8049
|
this.mainView = this.createMainView();
|
|
8018
8050
|
this.mainView.disableCameraTransform = disableCameraTransform;
|
|
8019
8051
|
this.mainView.divElement = divElement;
|
|
8052
|
+
this.observeMainViewDivElement();
|
|
8020
8053
|
this.addMainViewListener();
|
|
8021
8054
|
this.start();
|
|
8022
8055
|
callbacks$1.emit("onMainViewRebind", this.mainView);
|
|
@@ -8054,6 +8087,20 @@ class MainViewProxy {
|
|
|
8054
8087
|
this.view.callbacks.off("onCameraUpdated", this.onCameraOrSizeUpdated);
|
|
8055
8088
|
this.view.callbacks.off("onSizeUpdated", this.onCameraOrSizeUpdated);
|
|
8056
8089
|
}
|
|
8090
|
+
observeMainViewDivElement() {
|
|
8091
|
+
this.disconnectMainViewResizeObserver();
|
|
8092
|
+
if (!("ResizeObserver" in window))
|
|
8093
|
+
return;
|
|
8094
|
+
if (!this.mainView.divElement)
|
|
8095
|
+
return;
|
|
8096
|
+
this.mainViewResizeObserver = new window.ResizeObserver(this.onResize);
|
|
8097
|
+
this.mainViewResizeObserver.observe(this.mainView.divElement);
|
|
8098
|
+
}
|
|
8099
|
+
disconnectMainViewResizeObserver() {
|
|
8100
|
+
var _a;
|
|
8101
|
+
(_a = this.mainViewResizeObserver) == null ? void 0 : _a.disconnect();
|
|
8102
|
+
this.mainViewResizeObserver = void 0;
|
|
8103
|
+
}
|
|
8057
8104
|
ensureMainViewSize() {
|
|
8058
8105
|
if ((!this.mainViewSize || this.mainViewSize.width === 0 || this.mainViewSize.height === 0) && this.mainView.size.width > 0 && this.mainView.size.height > 0) {
|
|
8059
8106
|
this.setMainViewSize(this.mainView.size);
|
|
@@ -8093,6 +8140,7 @@ class MainViewProxy {
|
|
|
8093
8140
|
}
|
|
8094
8141
|
destroy() {
|
|
8095
8142
|
this.removeMainViewListener();
|
|
8143
|
+
this.disconnectMainViewResizeObserver();
|
|
8096
8144
|
this.stop();
|
|
8097
8145
|
this.sideEffectManager.flushAll();
|
|
8098
8146
|
}
|
|
@@ -19801,7 +19849,7 @@ const reconnectRefresher = new ReconnectRefresher({ emitter: internalEmitter });
|
|
|
19801
19849
|
const _WindowManager = class extends InvisiblePlugin {
|
|
19802
19850
|
constructor(context) {
|
|
19803
19851
|
super(context);
|
|
19804
|
-
this.version = "1.0.13-test.
|
|
19852
|
+
this.version = "1.0.13-test.12";
|
|
19805
19853
|
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" } };
|
|
19806
19854
|
this.emitter = callbacks$1;
|
|
19807
19855
|
this.viewMode = ViewMode.Broadcaster;
|