@netless/window-manager 1.0.0-canary.33 → 1.0.0-canary.34

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.
@@ -7,13 +7,14 @@ import {
7
7
  reaction,
8
8
  unlistenDisposed,
9
9
  unlistenUpdated,
10
- toJS,
10
+ toJS
11
11
  } from "white-web-sdk";
12
12
  import type {
13
13
  Room,
14
14
  SceneDefinition,
15
15
  View,
16
- EventListener as WhiteEventListener
16
+ EventListener as WhiteEventListener,
17
+ Player
17
18
  } from "white-web-sdk";
18
19
  import type { ReadonlyTeleBox } from "@netless/telebox-insider";
19
20
  import type Emittery from "emittery";
@@ -91,6 +92,15 @@ export class AppContext<TAttributes = any, TMagixEventPayloads = any, TAppOption
91
92
  return this.appProxy.view;
92
93
  };
93
94
 
95
+ public get now(): number {
96
+ if (this.isReplay) {
97
+ const player = this.displayer as Player;
98
+ return player.beginTimestamp + player.progressTime;
99
+ } else {
100
+ return (this.displayer as Room).calibrationTimestamp;
101
+ }
102
+ }
103
+
94
104
  public createWhiteBoardView = (params?: CreateWhiteBoardViewParams): WhiteBoardView => {
95
105
  if (this.whiteBoardView) {
96
106
  return this.whiteBoardView;
@@ -1,12 +1,8 @@
1
1
  import AppDocsViewer from "@netless/app-docs-viewer";
2
- import AppMediaPlayer, { setOptions } from "@netless/app-media-player";
2
+ import AppMediaPlayer from "@netless/app-media-player";
3
3
  import { WindowManager } from "./index";
4
4
 
5
5
  export const setupBuiltin = () => {
6
- if (WindowManager.debug) {
7
- setOptions({ verbose: true });
8
- }
9
-
10
6
  WindowManager.register({
11
7
  kind: AppDocsViewer.kind,
12
8
  src: AppDocsViewer,
@@ -35,7 +35,7 @@ export class CameraSynchronizer {
35
35
  const nextScale = camera.scale * Math.min(wScale, hScale);
36
36
  const config: Partial<Camera> & { animationMode: AnimationMode } = {
37
37
  scale: nextScale,
38
- animationMode: AnimationMode.Continuous,
38
+ animationMode: AnimationMode.Immediately,
39
39
  }
40
40
  if (camera.centerX !== null) {
41
41
  config.centerX = camera.centerX;
@@ -65,6 +65,6 @@ export class CameraSynchronizer {
65
65
  }
66
66
 
67
67
  private moveCamera(camera: Partial<Camera>) {
68
- this.view?.moveCamera({ ...camera, animationMode: AnimationMode.Continuous });
68
+ this.view?.moveCamera({ ...camera, animationMode: AnimationMode.Immediately });
69
69
  }
70
70
  }
package/src/index.ts CHANGED
@@ -136,8 +136,6 @@ export type MountParams = {
136
136
  containerSizeRatio?: number;
137
137
  /** @deprecated */
138
138
  chessboard?: boolean;
139
- /** 是否高亮显示同步区域, 默认为 true */
140
- highlightStage?: boolean;
141
139
  collectorContainer?: HTMLElement;
142
140
  collectorStyles?: Partial<CSSStyleDeclaration>;
143
141
  overwriteStyles?: string;
@@ -663,17 +661,17 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> imple
663
661
  }
664
662
  }
665
663
 
666
- public get baseCamera$() {
664
+ public get baseCamera() {
667
665
  if (this.appManager) {
668
- return this.appManager.mainViewProxy.camera$;
666
+ return this.appManager.mainViewProxy.camera$.value;
669
667
  } else {
670
668
  throw new Errors.AppManagerNotInitError();
671
669
  }
672
670
  }
673
671
 
674
- public get baseSize$() {
672
+ public get baseSize() {
675
673
  if (this.appManager) {
676
- return this.appManager.mainViewProxy.size$;
674
+ return this.appManager.mainViewProxy.size$.value;
677
675
  } else {
678
676
  throw new Errors.AppManagerNotInitError();
679
677
  }
package/vite.config.js CHANGED
@@ -15,7 +15,9 @@ export default defineConfig(({ mode }) => {
15
15
  inline: [
16
16
  "@juggle/resize-observer"
17
17
  ]
18
- }
18
+ },
19
+ setupFiles: "./test/setup.ts",
20
+ include: ["test/**/*.test.ts"],
19
21
  },
20
22
  define: {
21
23
  __APP_VERSION__: JSON.stringify(version),