@netless/window-manager 1.0.0-canary.44 → 1.0.0-canary.45

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netless/window-manager",
3
- "version": "1.0.0-canary.44",
3
+ "version": "1.0.0-canary.45",
4
4
  "description": "",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.es.js",
@@ -34,7 +34,7 @@
34
34
  "value-enhancer": "^1.3.2"
35
35
  },
36
36
  "devDependencies": {
37
- "@netless/app-docs-viewer": "^0.3.0",
37
+ "@netless/app-docs-viewer": "^0.3.2",
38
38
  "@netless/app-plyr": "0.2.0",
39
39
  "@playwright/test": "^1.23.2",
40
40
  "@rollup/plugin-commonjs": "^20.0.0",
package/pnpm-lock.yaml CHANGED
@@ -2,7 +2,7 @@ lockfileVersion: 5.4
2
2
 
3
3
  specifiers:
4
4
  '@juggle/resize-observer': ^3.3.1
5
- '@netless/app-docs-viewer': ^0.3.0
5
+ '@netless/app-docs-viewer': ^0.3.2
6
6
  '@netless/app-plyr': 0.2.0
7
7
  '@netless/telebox-insider': 1.0.0-alpha.35
8
8
  '@playwright/test': ^1.23.2
@@ -54,7 +54,7 @@ dependencies:
54
54
  value-enhancer: 1.3.2
55
55
 
56
56
  devDependencies:
57
- '@netless/app-docs-viewer': 0.3.0
57
+ '@netless/app-docs-viewer': 0.3.2
58
58
  '@netless/app-plyr': 0.2.0
59
59
  '@playwright/test': 1.23.2
60
60
  '@rollup/plugin-commonjs': 20.0.0
@@ -231,8 +231,8 @@ packages:
231
231
  resolution: {integrity: sha512-6Wci+Tp3CgPt/B9B0a3J4s3yMgLNSku6w5TV6mN+61C71UqsRBv2FUibBf3tPGlNxebgPHMEUzKpb1ggE8KCKw==}
232
232
  dev: true
233
233
 
234
- /@netless/app-docs-viewer/0.3.0:
235
- resolution: {integrity: sha512-L+637oRiLvROQzcppvod2Qwmri1qg0GBMuQKow1Qsrt4HT2KYjAXz8ShBELcUs/+ISgvsyont0CipiBrBlbYsA==}
234
+ /@netless/app-docs-viewer/0.3.2:
235
+ resolution: {integrity: sha512-3gO8/AblCYQlu5kEnvI6+qJBu0VycSnIyVXfP6xu5obHHfF5aa+JGnDJ1/wZ+8DpvaydhWTuKvv+oVtuXDG0gg==}
236
236
  dependencies:
237
237
  remitter: 0.2.6
238
238
  value-enhancer: 1.3.2
package/src/index.ts CHANGED
@@ -185,6 +185,7 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> imple
185
185
  private static params?: MountParams;
186
186
 
187
187
  private cameraUpdating = 0;
188
+ private nextCamera: Camera | null = null;
188
189
 
189
190
  public containerSizeRatio = WindowManager.containerSizeRatio;
190
191
 
@@ -834,27 +835,32 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> imple
834
835
  this.mainView.moveCamera(camera);
835
836
  }
836
837
  this.appManager.dispatchInternalEvent(Events.MoveCamera, camera);
837
- const onCameraUpdated = () => {
838
- if (this.cameraUpdating) {
839
- clearTimeout(this.cameraUpdating);
840
- }
841
- this.cameraUpdating = setTimeout(() => {
842
- this.mainView.callbacks.off("onCameraUpdated", onCameraUpdated);
843
- clearTimeout(this.cameraUpdating);
844
- this.cameraUpdating = 0;
845
- if (!this.appManager) return;
846
- this.appManager.mainViewProxy.storeCamera({
847
- id: this.appManager.uid,
848
- ...nextCamera
849
- });
850
- }, 50);
851
- }
852
- this.mainView.callbacks.off("onCameraUpdated", onCameraUpdated);
853
- this.mainView.callbacks.on("onCameraUpdated", onCameraUpdated);
854
-
838
+ this.mainView.callbacks.off("onCameraUpdated", this.onCameraUpdated);
839
+ clearTimeout(this.cameraUpdating);
840
+ this.cameraUpdating = 0;
841
+ this.mainView.callbacks.on("onCameraUpdated", this.onCameraUpdated);
842
+ this.nextCamera = nextCamera;
855
843
  }
856
844
  };
857
845
 
846
+ private onCameraUpdated = () => {
847
+ if (this.cameraUpdating) {
848
+ clearTimeout(this.cameraUpdating);
849
+ this.cameraUpdating = 0;
850
+ }
851
+ this.cameraUpdating = setTimeout(() => {
852
+ this.mainView.callbacks.off("onCameraUpdated", this.onCameraUpdated);
853
+ clearTimeout(this.cameraUpdating);
854
+ this.cameraUpdating = 0;
855
+ if (!this.appManager || !this.nextCamera) return;
856
+ this.appManager.mainViewProxy.storeCamera({
857
+ id: this.appManager.uid,
858
+ ...this.nextCamera
859
+ });
860
+ this.nextCamera = null;
861
+ }, 50);
862
+ }
863
+
858
864
  public convertToPointInWorld(point: Point): Point {
859
865
  return this.mainView.convertToPointInWorld(point);
860
866
  }
package/vite.config.js CHANGED
@@ -5,8 +5,8 @@ import { svelte } from "@sveltejs/vite-plugin-svelte";
5
5
  import { dependencies, peerDependencies, version, devDependencies } from "./package.json"
6
6
  import { omit } from "lodash";
7
7
 
8
- export default defineConfig(({ mode }) => {
9
- const isProd = mode === "production";
8
+ export default defineConfig(() => {
9
+ // const isProd = mode === "production";
10
10
 
11
11
  return {
12
12
  test: {
@@ -40,7 +40,8 @@ export default defineConfig(({ mode }) => {
40
40
  entry: path.resolve(__dirname, "src/index.ts"),
41
41
  formats: ["es", "umd", "cjs"],
42
42
  name: "WindowManager",
43
- fileName: "index"
43
+ fileName: "index",
44
+
44
45
  },
45
46
  outDir: "dist",
46
47
  rollupOptions: {
@@ -49,7 +50,7 @@ export default defineConfig(({ mode }) => {
49
50
  ...peerDependencies,
50
51
  }),
51
52
  },
52
- minify: isProd
53
+ minify: false
53
54
  },
54
55
  };
55
56
  })