@netless/window-manager 1.0.0-canary.63 → 1.0.0-canary.64

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.js CHANGED
@@ -873,7 +873,7 @@ class WhiteBoardView {
873
873
  const camera$ = new valueEnhancer.Val(pickCamera(this.view.camera));
874
874
  this.baseRect$ = baseRect$;
875
875
  this.pageState$ = pageState$;
876
- this.baseCamera$ = camera$;
876
+ this.camera$ = camera$;
877
877
  this.appProxy.sideEffectManager.add(() => [
878
878
  appProxy.appEmitter.on("pageStateChange", (pageState) => pageState$.setValue(pageState)),
879
879
  appProxy.camera$.subscribe((camera) => {
@@ -1328,7 +1328,7 @@ class CameraSynchronizer {
1328
1328
  }
1329
1329
  }
1330
1330
  moveCamera(camera) {
1331
- if (!lodash.isEmpty(camera) && this.view && camera.centerX && camera.centerY) {
1331
+ if (!lodash.isEmpty(camera) && this.view && camera.centerX != null && camera.centerY != null) {
1332
1332
  if (lodash.isEqual(camera, this.view.camera))
1333
1333
  return;
1334
1334
  const { centerX, centerY, scale: scale2 } = camera;
@@ -2560,11 +2560,6 @@ class MainViewProxy {
2560
2560
  }
2561
2561
  }
2562
2562
  }));
2563
- this.camera$.reaction((camera) => {
2564
- if (camera) {
2565
- callbacks.emit("baseCameraChange", camera);
2566
- }
2567
- });
2568
2563
  this.size$.reaction((size) => {
2569
2564
  if (size) {
2570
2565
  callbacks.emit("baseSizeChange", size);
@@ -12756,7 +12751,7 @@ const reconnectRefresher = new ReconnectRefresher({ emitter });
12756
12751
  const _WindowManager = class extends whiteWebSdk.InvisiblePlugin {
12757
12752
  constructor(context) {
12758
12753
  super(context);
12759
- this.version = "1.0.0-canary.63";
12754
+ this.version = "1.0.0-canary.64";
12760
12755
  this.dependencies = { "dependencies": { "@juggle/resize-observer": "^3.3.1", "@netless/synced-store": "^2.0.7", "@netless/telebox-insider": "1.0.0-alpha.37", "emittery": "^0.11.0", "lodash": "^4.17.21", "p-retry": "^4.6.2", "side-effect-manager": "^1.2.1", "uuid": "^7.0.3", "value-enhancer": "^1.3.2" }, "peerDependencies": { "white-web-sdk": "^2.16.0" }, "devDependencies": { "@netless/app-docs-viewer": "^1.0.0-canary.3", "@netless/app-plyr": "^0.2.3", "@playwright/test": "^1.23.2", "@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.49", "@tsconfig/svelte": "^2.0.1", "@types/debug": "^4.1.7", "@types/lodash": "^4.14.182", "@types/lodash-es": "^4.17.6", "@types/node": "^18.0.3", "@types/uuid": "^8.3.4", "@typescript-eslint/eslint-plugin": "^4.30.0", "@typescript-eslint/parser": "^4.30.0", "@vitest/ui": "^0.14.2", "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", "less": "^4.1.3", "prettier": "^2.3.2", "prettier-plugin-svelte": "^2.4.0", "rollup-plugin-analyzer": "^4.0.0", "rollup-plugin-styles": "^3.14.1", "svelte": "^3.42.4", "typescript": "^4.5.5", "vite": "^3.1.3", "vite-plugin-dts": "^1.5.0", "vitest": "^0.23.4", "white-web-sdk": "^2.16.35" } };
12761
12756
  this.emitter = callbacks;
12762
12757
  this.viewMode$ = new valueEnhancer.Val(whiteWebSdk.ViewMode.Broadcaster);
@@ -12774,15 +12769,19 @@ const _WindowManager = class extends whiteWebSdk.InvisiblePlugin {
12774
12769
  (_a2 = this.appManager) == null ? void 0 : _a2.dispatchInternalEvent(Events.MoveCamera, camera);
12775
12770
  };
12776
12771
  this.debouncedStoreCamera = () => {
12777
- const storeCamera = lodash.debounce(() => {
12778
- var _a2, _b, _c;
12772
+ const cameraListener = lodash.debounce(() => {
12773
+ var _a2;
12779
12774
  (_a2 = this.appManager) == null ? void 0 : _a2.mainViewProxy.saveToCamera$();
12780
- (_b = this.appManager) == null ? void 0 : _b.mainViewProxy.storeCurrentCamera();
12781
- (_c = this.appManager) == null ? void 0 : _c.mainViewProxy.storeCurrentSize();
12782
- this.mainView.callbacks.off("onCameraUpdated", storeCamera);
12783
- }, 200);
12784
- this.mainView.callbacks.on("onCameraUpdated", storeCamera);
12775
+ this.storeCamera();
12776
+ this.mainView.callbacks.off("onCameraUpdated", cameraListener);
12777
+ }, 50);
12778
+ this.mainView.callbacks.on("onCameraUpdated", cameraListener);
12785
12779
  };
12780
+ this.storeCamera = lodash.debounce(() => {
12781
+ var _a2, _b;
12782
+ (_a2 = this.appManager) == null ? void 0 : _a2.mainViewProxy.storeCurrentCamera();
12783
+ (_b = this.appManager) == null ? void 0 : _b.mainViewProxy.storeCurrentSize();
12784
+ }, 300);
12786
12785
  _WindowManager.displayer = context.displayer;
12787
12786
  window.NETLESS_DEPS = { "dependencies": { "@juggle/resize-observer": "^3.3.1", "@netless/synced-store": "^2.0.7", "@netless/telebox-insider": "1.0.0-alpha.37", "emittery": "^0.11.0", "lodash": "^4.17.21", "p-retry": "^4.6.2", "side-effect-manager": "^1.2.1", "uuid": "^7.0.3", "value-enhancer": "^1.3.2" }, "peerDependencies": { "white-web-sdk": "^2.16.0" }, "devDependencies": { "@netless/app-docs-viewer": "^1.0.0-canary.3", "@netless/app-plyr": "^0.2.3", "@playwright/test": "^1.23.2", "@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.49", "@tsconfig/svelte": "^2.0.1", "@types/debug": "^4.1.7", "@types/lodash": "^4.14.182", "@types/lodash-es": "^4.17.6", "@types/node": "^18.0.3", "@types/uuid": "^8.3.4", "@typescript-eslint/eslint-plugin": "^4.30.0", "@typescript-eslint/parser": "^4.30.0", "@vitest/ui": "^0.14.2", "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", "less": "^4.1.3", "prettier": "^2.3.2", "prettier-plugin-svelte": "^2.4.0", "rollup-plugin-analyzer": "^4.0.0", "rollup-plugin-styles": "^3.14.1", "svelte": "^3.42.4", "typescript": "^4.5.5", "vite": "^3.1.3", "vite-plugin-dts": "^1.5.0", "vitest": "^0.23.4", "white-web-sdk": "^2.16.35" } };
12788
12787
  }
@@ -13164,8 +13163,8 @@ const _WindowManager = class extends whiteWebSdk.InvisiblePlugin {
13164
13163
  var _a2;
13165
13164
  log("setViewMode", mode);
13166
13165
  const mainViewProxy = (_a2 = this.appManager) == null ? void 0 : _a2.mainViewProxy;
13167
- if (mode === whiteWebSdk.ViewMode.Broadcaster) {
13168
- if (this.canOperate) {
13166
+ if (mode === whiteWebSdk.ViewMode.Broadcaster || mode === whiteWebSdk.ViewMode.Follower) {
13167
+ if (this.canOperate && mode === whiteWebSdk.ViewMode.Broadcaster) {
13169
13168
  mainViewProxy == null ? void 0 : mainViewProxy.storeCurrentCamera();
13170
13169
  mainViewProxy == null ? void 0 : mainViewProxy.storeCurrentSize();
13171
13170
  }
package/dist/index.mjs CHANGED
@@ -868,7 +868,7 @@ class WhiteBoardView {
868
868
  const camera$ = new Val(pickCamera(this.view.camera));
869
869
  this.baseRect$ = baseRect$;
870
870
  this.pageState$ = pageState$;
871
- this.baseCamera$ = camera$;
871
+ this.camera$ = camera$;
872
872
  this.appProxy.sideEffectManager.add(() => [
873
873
  appProxy.appEmitter.on("pageStateChange", (pageState) => pageState$.setValue(pageState)),
874
874
  appProxy.camera$.subscribe((camera) => {
@@ -1323,7 +1323,7 @@ class CameraSynchronizer {
1323
1323
  }
1324
1324
  }
1325
1325
  moveCamera(camera) {
1326
- if (!isEmpty(camera) && this.view && camera.centerX && camera.centerY) {
1326
+ if (!isEmpty(camera) && this.view && camera.centerX != null && camera.centerY != null) {
1327
1327
  if (isEqual(camera, this.view.camera))
1328
1328
  return;
1329
1329
  const { centerX, centerY, scale: scale2 } = camera;
@@ -2555,11 +2555,6 @@ class MainViewProxy {
2555
2555
  }
2556
2556
  }
2557
2557
  }));
2558
- this.camera$.reaction((camera) => {
2559
- if (camera) {
2560
- callbacks.emit("baseCameraChange", camera);
2561
- }
2562
- });
2563
2558
  this.size$.reaction((size) => {
2564
2559
  if (size) {
2565
2560
  callbacks.emit("baseSizeChange", size);
@@ -12751,7 +12746,7 @@ const reconnectRefresher = new ReconnectRefresher({ emitter });
12751
12746
  const _WindowManager = class extends InvisiblePlugin {
12752
12747
  constructor(context) {
12753
12748
  super(context);
12754
- this.version = "1.0.0-canary.63";
12749
+ this.version = "1.0.0-canary.64";
12755
12750
  this.dependencies = { "dependencies": { "@juggle/resize-observer": "^3.3.1", "@netless/synced-store": "^2.0.7", "@netless/telebox-insider": "1.0.0-alpha.37", "emittery": "^0.11.0", "lodash": "^4.17.21", "p-retry": "^4.6.2", "side-effect-manager": "^1.2.1", "uuid": "^7.0.3", "value-enhancer": "^1.3.2" }, "peerDependencies": { "white-web-sdk": "^2.16.0" }, "devDependencies": { "@netless/app-docs-viewer": "^1.0.0-canary.3", "@netless/app-plyr": "^0.2.3", "@playwright/test": "^1.23.2", "@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.49", "@tsconfig/svelte": "^2.0.1", "@types/debug": "^4.1.7", "@types/lodash": "^4.14.182", "@types/lodash-es": "^4.17.6", "@types/node": "^18.0.3", "@types/uuid": "^8.3.4", "@typescript-eslint/eslint-plugin": "^4.30.0", "@typescript-eslint/parser": "^4.30.0", "@vitest/ui": "^0.14.2", "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", "less": "^4.1.3", "prettier": "^2.3.2", "prettier-plugin-svelte": "^2.4.0", "rollup-plugin-analyzer": "^4.0.0", "rollup-plugin-styles": "^3.14.1", "svelte": "^3.42.4", "typescript": "^4.5.5", "vite": "^3.1.3", "vite-plugin-dts": "^1.5.0", "vitest": "^0.23.4", "white-web-sdk": "^2.16.35" } };
12756
12751
  this.emitter = callbacks;
12757
12752
  this.viewMode$ = new Val(ViewMode.Broadcaster);
@@ -12769,15 +12764,19 @@ const _WindowManager = class extends InvisiblePlugin {
12769
12764
  (_a2 = this.appManager) == null ? void 0 : _a2.dispatchInternalEvent(Events.MoveCamera, camera);
12770
12765
  };
12771
12766
  this.debouncedStoreCamera = () => {
12772
- const storeCamera = debounce(() => {
12773
- var _a2, _b, _c;
12767
+ const cameraListener = debounce(() => {
12768
+ var _a2;
12774
12769
  (_a2 = this.appManager) == null ? void 0 : _a2.mainViewProxy.saveToCamera$();
12775
- (_b = this.appManager) == null ? void 0 : _b.mainViewProxy.storeCurrentCamera();
12776
- (_c = this.appManager) == null ? void 0 : _c.mainViewProxy.storeCurrentSize();
12777
- this.mainView.callbacks.off("onCameraUpdated", storeCamera);
12778
- }, 200);
12779
- this.mainView.callbacks.on("onCameraUpdated", storeCamera);
12770
+ this.storeCamera();
12771
+ this.mainView.callbacks.off("onCameraUpdated", cameraListener);
12772
+ }, 50);
12773
+ this.mainView.callbacks.on("onCameraUpdated", cameraListener);
12780
12774
  };
12775
+ this.storeCamera = debounce(() => {
12776
+ var _a2, _b;
12777
+ (_a2 = this.appManager) == null ? void 0 : _a2.mainViewProxy.storeCurrentCamera();
12778
+ (_b = this.appManager) == null ? void 0 : _b.mainViewProxy.storeCurrentSize();
12779
+ }, 300);
12781
12780
  _WindowManager.displayer = context.displayer;
12782
12781
  window.NETLESS_DEPS = { "dependencies": { "@juggle/resize-observer": "^3.3.1", "@netless/synced-store": "^2.0.7", "@netless/telebox-insider": "1.0.0-alpha.37", "emittery": "^0.11.0", "lodash": "^4.17.21", "p-retry": "^4.6.2", "side-effect-manager": "^1.2.1", "uuid": "^7.0.3", "value-enhancer": "^1.3.2" }, "peerDependencies": { "white-web-sdk": "^2.16.0" }, "devDependencies": { "@netless/app-docs-viewer": "^1.0.0-canary.3", "@netless/app-plyr": "^0.2.3", "@playwright/test": "^1.23.2", "@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.49", "@tsconfig/svelte": "^2.0.1", "@types/debug": "^4.1.7", "@types/lodash": "^4.14.182", "@types/lodash-es": "^4.17.6", "@types/node": "^18.0.3", "@types/uuid": "^8.3.4", "@typescript-eslint/eslint-plugin": "^4.30.0", "@typescript-eslint/parser": "^4.30.0", "@vitest/ui": "^0.14.2", "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", "less": "^4.1.3", "prettier": "^2.3.2", "prettier-plugin-svelte": "^2.4.0", "rollup-plugin-analyzer": "^4.0.0", "rollup-plugin-styles": "^3.14.1", "svelte": "^3.42.4", "typescript": "^4.5.5", "vite": "^3.1.3", "vite-plugin-dts": "^1.5.0", "vitest": "^0.23.4", "white-web-sdk": "^2.16.35" } };
12783
12782
  }
@@ -13159,8 +13158,8 @@ const _WindowManager = class extends InvisiblePlugin {
13159
13158
  var _a2;
13160
13159
  log("setViewMode", mode);
13161
13160
  const mainViewProxy = (_a2 = this.appManager) == null ? void 0 : _a2.mainViewProxy;
13162
- if (mode === ViewMode.Broadcaster) {
13163
- if (this.canOperate) {
13161
+ if (mode === ViewMode.Broadcaster || mode === ViewMode.Follower) {
13162
+ if (this.canOperate && mode === ViewMode.Broadcaster) {
13164
13163
  mainViewProxy == null ? void 0 : mainViewProxy.storeCurrentCamera();
13165
13164
  mainViewProxy == null ? void 0 : mainViewProxy.storeCurrentSize();
13166
13165
  }
package/dist/index.umd.js CHANGED
@@ -866,7 +866,7 @@
866
866
  const camera$ = new valueEnhancer.Val(pickCamera(this.view.camera));
867
867
  this.baseRect$ = baseRect$;
868
868
  this.pageState$ = pageState$;
869
- this.baseCamera$ = camera$;
869
+ this.camera$ = camera$;
870
870
  this.appProxy.sideEffectManager.add(() => [
871
871
  appProxy.appEmitter.on("pageStateChange", (pageState) => pageState$.setValue(pageState)),
872
872
  appProxy.camera$.subscribe((camera) => {
@@ -1321,7 +1321,7 @@
1321
1321
  }
1322
1322
  }
1323
1323
  moveCamera(camera) {
1324
- if (!lodash.isEmpty(camera) && this.view && camera.centerX && camera.centerY) {
1324
+ if (!lodash.isEmpty(camera) && this.view && camera.centerX != null && camera.centerY != null) {
1325
1325
  if (lodash.isEqual(camera, this.view.camera))
1326
1326
  return;
1327
1327
  const { centerX, centerY, scale: scale2 } = camera;
@@ -2553,11 +2553,6 @@
2553
2553
  }
2554
2554
  }
2555
2555
  }));
2556
- this.camera$.reaction((camera) => {
2557
- if (camera) {
2558
- callbacks.emit("baseCameraChange", camera);
2559
- }
2560
- });
2561
2556
  this.size$.reaction((size) => {
2562
2557
  if (size) {
2563
2558
  callbacks.emit("baseSizeChange", size);
@@ -12749,7 +12744,7 @@
12749
12744
  const _WindowManager = class extends whiteWebSdk.InvisiblePlugin {
12750
12745
  constructor(context) {
12751
12746
  super(context);
12752
- this.version = "1.0.0-canary.63";
12747
+ this.version = "1.0.0-canary.64";
12753
12748
  this.dependencies = { "dependencies": { "@juggle/resize-observer": "^3.3.1", "@netless/synced-store": "^2.0.7", "@netless/telebox-insider": "1.0.0-alpha.37", "emittery": "^0.11.0", "lodash": "^4.17.21", "p-retry": "^4.6.2", "side-effect-manager": "^1.2.1", "uuid": "^7.0.3", "value-enhancer": "^1.3.2" }, "peerDependencies": { "white-web-sdk": "^2.16.0" }, "devDependencies": { "@netless/app-docs-viewer": "^1.0.0-canary.3", "@netless/app-plyr": "^0.2.3", "@playwright/test": "^1.23.2", "@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.49", "@tsconfig/svelte": "^2.0.1", "@types/debug": "^4.1.7", "@types/lodash": "^4.14.182", "@types/lodash-es": "^4.17.6", "@types/node": "^18.0.3", "@types/uuid": "^8.3.4", "@typescript-eslint/eslint-plugin": "^4.30.0", "@typescript-eslint/parser": "^4.30.0", "@vitest/ui": "^0.14.2", "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", "less": "^4.1.3", "prettier": "^2.3.2", "prettier-plugin-svelte": "^2.4.0", "rollup-plugin-analyzer": "^4.0.0", "rollup-plugin-styles": "^3.14.1", "svelte": "^3.42.4", "typescript": "^4.5.5", "vite": "^3.1.3", "vite-plugin-dts": "^1.5.0", "vitest": "^0.23.4", "white-web-sdk": "^2.16.35" } };
12754
12749
  this.emitter = callbacks;
12755
12750
  this.viewMode$ = new valueEnhancer.Val(whiteWebSdk.ViewMode.Broadcaster);
@@ -12767,15 +12762,19 @@
12767
12762
  (_a2 = this.appManager) == null ? void 0 : _a2.dispatchInternalEvent(Events.MoveCamera, camera);
12768
12763
  };
12769
12764
  this.debouncedStoreCamera = () => {
12770
- const storeCamera = lodash.debounce(() => {
12771
- var _a2, _b, _c;
12765
+ const cameraListener = lodash.debounce(() => {
12766
+ var _a2;
12772
12767
  (_a2 = this.appManager) == null ? void 0 : _a2.mainViewProxy.saveToCamera$();
12773
- (_b = this.appManager) == null ? void 0 : _b.mainViewProxy.storeCurrentCamera();
12774
- (_c = this.appManager) == null ? void 0 : _c.mainViewProxy.storeCurrentSize();
12775
- this.mainView.callbacks.off("onCameraUpdated", storeCamera);
12776
- }, 200);
12777
- this.mainView.callbacks.on("onCameraUpdated", storeCamera);
12768
+ this.storeCamera();
12769
+ this.mainView.callbacks.off("onCameraUpdated", cameraListener);
12770
+ }, 50);
12771
+ this.mainView.callbacks.on("onCameraUpdated", cameraListener);
12778
12772
  };
12773
+ this.storeCamera = lodash.debounce(() => {
12774
+ var _a2, _b;
12775
+ (_a2 = this.appManager) == null ? void 0 : _a2.mainViewProxy.storeCurrentCamera();
12776
+ (_b = this.appManager) == null ? void 0 : _b.mainViewProxy.storeCurrentSize();
12777
+ }, 300);
12779
12778
  _WindowManager.displayer = context.displayer;
12780
12779
  window.NETLESS_DEPS = { "dependencies": { "@juggle/resize-observer": "^3.3.1", "@netless/synced-store": "^2.0.7", "@netless/telebox-insider": "1.0.0-alpha.37", "emittery": "^0.11.0", "lodash": "^4.17.21", "p-retry": "^4.6.2", "side-effect-manager": "^1.2.1", "uuid": "^7.0.3", "value-enhancer": "^1.3.2" }, "peerDependencies": { "white-web-sdk": "^2.16.0" }, "devDependencies": { "@netless/app-docs-viewer": "^1.0.0-canary.3", "@netless/app-plyr": "^0.2.3", "@playwright/test": "^1.23.2", "@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.49", "@tsconfig/svelte": "^2.0.1", "@types/debug": "^4.1.7", "@types/lodash": "^4.14.182", "@types/lodash-es": "^4.17.6", "@types/node": "^18.0.3", "@types/uuid": "^8.3.4", "@typescript-eslint/eslint-plugin": "^4.30.0", "@typescript-eslint/parser": "^4.30.0", "@vitest/ui": "^0.14.2", "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", "less": "^4.1.3", "prettier": "^2.3.2", "prettier-plugin-svelte": "^2.4.0", "rollup-plugin-analyzer": "^4.0.0", "rollup-plugin-styles": "^3.14.1", "svelte": "^3.42.4", "typescript": "^4.5.5", "vite": "^3.1.3", "vite-plugin-dts": "^1.5.0", "vitest": "^0.23.4", "white-web-sdk": "^2.16.35" } };
12781
12780
  }
@@ -13157,8 +13156,8 @@
13157
13156
  var _a2;
13158
13157
  log("setViewMode", mode);
13159
13158
  const mainViewProxy = (_a2 = this.appManager) == null ? void 0 : _a2.mainViewProxy;
13160
- if (mode === whiteWebSdk.ViewMode.Broadcaster) {
13161
- if (this.canOperate) {
13159
+ if (mode === whiteWebSdk.ViewMode.Broadcaster || mode === whiteWebSdk.ViewMode.Follower) {
13160
+ if (this.canOperate && mode === whiteWebSdk.ViewMode.Broadcaster) {
13162
13161
  mainViewProxy == null ? void 0 : mainViewProxy.storeCurrentCamera();
13163
13162
  mainViewProxy == null ? void 0 : mainViewProxy.storeCurrentSize();
13164
13163
  }
@@ -13,7 +13,7 @@ export declare class WhiteBoardView implements PageController {
13
13
  protected appProxy: AppProxy;
14
14
  ensureSize: (size: number) => void;
15
15
  readonly pageState$: ReadonlyVal<PageState>;
16
- readonly baseCamera$: ReadonlyVal<WhiteBoardViewCamera>;
16
+ readonly camera$: ReadonlyVal<WhiteBoardViewCamera>;
17
17
  readonly baseRect$: ReadonlyVal<WhiteBoardViewRect | undefined>;
18
18
  constructor(view: View, appContext: AppContext, appProxy: AppProxy, ensureSize: (size: number) => void);
19
19
  get pageState(): PageState;
@@ -3,7 +3,7 @@ import type { TeleBoxColorScheme, TeleBoxFullscreen, TELE_BOX_STATE } from "@net
3
3
  import type { CameraState, SceneState, ViewVisionMode } from "white-web-sdk";
4
4
  import type { LoadAppEvent } from "./Register";
5
5
  import type { PageState } from "./Page";
6
- import type { ICamera, ISize } from "./AttributesDelegate";
6
+ import type { ISize } from "./AttributesDelegate";
7
7
  import type { ScrollState } from "./View/ScrollMode";
8
8
  export declare type PublicEvent = {
9
9
  mainViewModeChange: ViewVisionMode;
@@ -26,7 +26,6 @@ export declare type PublicEvent = {
26
26
  kind: string;
27
27
  error?: Error;
28
28
  };
29
- baseCameraChange: ICamera;
30
29
  baseSizeChange: ISize;
31
30
  fullscreenChange: TeleBoxFullscreen;
32
31
  userScroll: undefined;
@@ -248,6 +248,7 @@ export declare class WindowManager extends InvisiblePlugin<WindowMangerAttribute
248
248
  animationMode?: AnimationMode;
249
249
  }>): void;
250
250
  private debouncedStoreCamera;
251
+ private storeCamera;
251
252
  convertToPointInWorld(point: Point): Point;
252
253
  setCameraBound(cameraBound: CameraBound): void;
253
254
  onDestroy(): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netless/window-manager",
3
- "version": "1.0.0-canary.63",
3
+ "version": "1.0.0-canary.64",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -15,7 +15,7 @@ export type WhiteBoardViewRect = Omit<ISize, "id">;
15
15
 
16
16
  export class WhiteBoardView implements PageController {
17
17
  public readonly pageState$: ReadonlyVal<PageState>;
18
- public readonly baseCamera$: ReadonlyVal<WhiteBoardViewCamera>;
18
+ public readonly camera$: ReadonlyVal<WhiteBoardViewCamera>;
19
19
  public readonly baseRect$: ReadonlyVal<WhiteBoardViewRect | undefined>;
20
20
 
21
21
  constructor(
@@ -31,7 +31,7 @@ export class WhiteBoardView implements PageController {
31
31
  const camera$ = new Val<WhiteBoardViewCamera>(pickCamera(this.view.camera));
32
32
  this.baseRect$ = baseRect$;
33
33
  this.pageState$ = pageState$;
34
- this.baseCamera$ = camera$;
34
+ this.camera$ = camera$;
35
35
  this.appProxy.sideEffectManager.add(() => [
36
36
  appProxy.appEmitter.on("pageStateChange", pageState => pageState$.setValue(pageState)),
37
37
  appProxy.camera$.subscribe(camera => {
@@ -75,7 +75,7 @@ export class CameraSynchronizer {
75
75
  }
76
76
 
77
77
  private moveCamera(camera: ICamera): void {
78
- if (!isEmpty(camera) && this.view && camera.centerX && camera.centerY) {
78
+ if (!isEmpty(camera) && this.view && camera.centerX != null && camera.centerY != null) {
79
79
  if (isEqual(camera, this.view.camera)) return;
80
80
  const { centerX, centerY, scale } = camera;
81
81
  const needScale = scale * (this.scale || 1);
@@ -49,11 +49,6 @@ export class MainViewProxy {
49
49
  }
50
50
  }
51
51
  }));
52
- this.camera$.reaction(camera => {
53
- if (camera) {
54
- callbacks.emit("baseCameraChange", camera);
55
- }
56
- });
57
52
  this.size$.reaction(size => {
58
53
  if (size) {
59
54
  callbacks.emit("baseSizeChange", size);
package/src/callback.ts CHANGED
@@ -3,7 +3,7 @@ import type { TeleBoxColorScheme, TeleBoxFullscreen, TELE_BOX_STATE } from "@net
3
3
  import type { CameraState, SceneState, ViewVisionMode } from "white-web-sdk";
4
4
  import type { LoadAppEvent } from "./Register";
5
5
  import type { PageState } from "./Page";
6
- import type { ICamera, ISize } from "./AttributesDelegate";
6
+ import type { ISize } from "./AttributesDelegate";
7
7
  import type { ScrollState } from "./View/ScrollMode";
8
8
 
9
9
  export type PublicEvent = {
@@ -23,7 +23,6 @@ export type PublicEvent = {
23
23
  sceneStateChange: SceneState;
24
24
  pageStateChange: PageState;
25
25
  appClose: { appId: string; kind: string, error?: Error };
26
- baseCameraChange: ICamera;
27
26
  baseSizeChange: ISize;
28
27
  fullscreenChange: TeleBoxFullscreen;
29
28
  userScroll: undefined;
package/src/index.ts CHANGED
@@ -627,8 +627,8 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes, any>
627
627
  public setViewMode(mode: ManagerViewMode): void {
628
628
  log("setViewMode", mode);
629
629
  const mainViewProxy = this.appManager?.mainViewProxy;
630
- if (mode === ViewMode.Broadcaster) {
631
- if (this.canOperate) {
630
+ if (mode === ViewMode.Broadcaster || mode === ViewMode.Follower) {
631
+ if (this.canOperate && mode === ViewMode.Broadcaster) {
632
632
  mainViewProxy?.storeCurrentCamera();
633
633
  mainViewProxy?.storeCurrentSize();
634
634
  }
@@ -851,15 +851,19 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes, any>
851
851
  }
852
852
 
853
853
  private debouncedStoreCamera = () => {
854
- const storeCamera = debounce(() => {
854
+ const cameraListener = debounce(() => {
855
855
  this.appManager?.mainViewProxy.saveToCamera$();
856
- this.appManager?.mainViewProxy.storeCurrentCamera();
857
- this.appManager?.mainViewProxy.storeCurrentSize();
858
- this.mainView.callbacks.off("onCameraUpdated", storeCamera);
859
- }, 200);
860
- this.mainView.callbacks.on("onCameraUpdated", storeCamera);
856
+ this.storeCamera();
857
+ this.mainView.callbacks.off("onCameraUpdated", cameraListener);
858
+ }, 50);
859
+ this.mainView.callbacks.on("onCameraUpdated", cameraListener);
861
860
  }
862
861
 
862
+ private storeCamera = debounce(() => {
863
+ this.appManager?.mainViewProxy.storeCurrentCamera();
864
+ this.appManager?.mainViewProxy.storeCurrentSize();
865
+ }, 300);
866
+
863
867
  public convertToPointInWorld(point: Point): Point {
864
868
  return this.mainView.convertToPointInWorld(point);
865
869
  }