@netless/window-manager 1.0.0-canary.37 → 1.0.0-canary.38

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.es.js CHANGED
@@ -495,13 +495,18 @@ class CameraSynchronizer {
495
495
  this.view = view;
496
496
  }
497
497
  onRemoteSizeUpdate(size2) {
498
+ var _a;
498
499
  this.remoteSize = size2;
499
500
  const needMoveCamera = !isEqual(pick(this.rect, ["width", "height"]), pick(size2, ["width", "height"]));
500
501
  if (this.rect && this.remoteCamera && needMoveCamera) {
501
- const scale2 = this.rect.width / size2.width;
502
- const nextScale = this.remoteCamera.scale * scale2;
503
- this.moveCamera({
504
- scale: nextScale
502
+ if (!this.view)
503
+ return;
504
+ const currentCamera = this.view.camera;
505
+ (_a = this.view) == null ? void 0 : _a.moveCameraToContain({
506
+ width: size2.width,
507
+ height: size2.height,
508
+ originX: currentCamera.centerX - size2.width / 2,
509
+ originY: currentCamera.centerY - size2.height / 2
505
510
  });
506
511
  }
507
512
  }
@@ -12900,7 +12905,7 @@ const reconnectRefresher = new ReconnectRefresher({ emitter });
12900
12905
  const _WindowManager = class extends InvisiblePlugin {
12901
12906
  constructor(context) {
12902
12907
  super(context);
12903
- this.version = "1.0.0-canary.37";
12908
+ this.version = "1.0.0-canary.38";
12904
12909
  this.dependencies = { "dependencies": { "@juggle/resize-observer": "^3.3.1", "@netless/telebox-insider": "1.0.0-alpha.33", "emittery": "^0.11.0", "lodash": "^4.17.21", "p-retry": "^4.6.2", "side-effect-manager": "^1.1.1", "uuid": "^7.0.3", "value-enhancer": "^1.3.2" }, "peerDependencies": { "white-web-sdk": "^2.16.0" }, "devDependencies": { "@netless/app-docs-viewer": "^0.3.0", "@netless/app-plyr": "0.2.0", "@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": "^2.5.3", "vite-plugin-dts": "^1.2.1", "vitest": "^0.18.0", "white-web-sdk": "2.16.26" } };
12905
12910
  this.emitter = callbacks;
12906
12911
  this.viewMode = ViewMode.Broadcaster;
@@ -13455,51 +13460,6 @@ const _WindowManager = class extends InvisiblePlugin {
13455
13460
  }, 200);
13456
13461
  }
13457
13462
  }
13458
- moveCameraToContain(rectangle) {
13459
- if (!this.appManager)
13460
- return;
13461
- const camera = {};
13462
- if (isNumber$2(rectangle.originX)) {
13463
- camera.centerX = rectangle.originX;
13464
- }
13465
- if (isNumber$2(rectangle.originY)) {
13466
- camera.centerY = rectangle.originY;
13467
- }
13468
- if (rectangle.animationMode === AnimationMode.Immediately) {
13469
- this.appManager.mainViewProxy.storeSize({
13470
- id: this.appManager.uid,
13471
- width: rectangle.width,
13472
- height: rectangle.height
13473
- });
13474
- this.mainView.moveCameraToContain(rectangle);
13475
- if (!isEmpty$2(camera) && this.appManager.mainViewProxy.camera$.value) {
13476
- this.appManager.mainViewProxy.storeCamera(__spreadProps(__spreadValues({}, this.appManager.mainViewProxy.camera$.value), {
13477
- id: this.appManager.uid,
13478
- centerX: this.mainView.camera.centerX,
13479
- centerY: this.mainView.camera.centerY
13480
- }));
13481
- }
13482
- } else {
13483
- this.appManager.dispatchInternalEvent(Events.MoveCameraToContain, rectangle);
13484
- this.mainView.moveCameraToContain(rectangle);
13485
- setTimeout(() => {
13486
- if (!this.appManager)
13487
- return;
13488
- this.appManager.mainViewProxy.storeSize({
13489
- id: this.appManager.uid,
13490
- width: rectangle.width,
13491
- height: rectangle.height
13492
- });
13493
- if (!isEmpty$2(camera) && this.appManager.mainViewProxy.camera$.value) {
13494
- this.appManager.mainViewProxy.storeCamera(__spreadProps(__spreadValues({}, this.appManager.mainViewProxy.camera$.value), {
13495
- id: this.appManager.uid,
13496
- centerX: this.mainView.camera.centerX,
13497
- centerY: this.mainView.camera.centerY
13498
- }));
13499
- }
13500
- }, 200);
13501
- }
13502
- }
13503
13463
  convertToPointInWorld(point) {
13504
13464
  return this.mainView.convertToPointInWorld(point);
13505
13465
  }