@netless/window-manager 1.0.0-canary.16 → 1.0.0-canary.17

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.16",
3
+ "version": "1.0.0-canary.17",
4
4
  "description": "",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.es.js",
@@ -47,7 +47,7 @@ export class AppContext<TAttributes = any, TMagixEventPayloads = any, TAppOption
47
47
  private store = this.manager.store;
48
48
  public readonly isAddApp: boolean;
49
49
  public readonly isReplay = this.manager.isReplay;
50
- private whiteBoardView?: WhiteBoardView;
50
+ public whiteBoardView?: WhiteBoardView;
51
51
  public _viewWrapper?: HTMLElement;
52
52
 
53
53
  constructor(
@@ -635,6 +635,8 @@ export class AppProxy implements PageRemoveService {
635
635
  this.manager.refresher.remove(this.id);
636
636
  this.manager.refresher.remove(this.stateKey);
637
637
  this.manager.refresher.remove(`${this.id}-fullPath`);
638
+ this.manager.refresher.remove(`${this.id}-camera`);
639
+ this.manager.refresher.remove(`${this.id}-size`);
638
640
  this.valManager.destroy();
639
641
  }
640
642
 
package/src/AppManager.ts CHANGED
@@ -659,7 +659,6 @@ export class AppManager {
659
659
  if (sceneState) {
660
660
  const scenePath = sceneState.scenePath;
661
661
  this.appProxies.forEach(appProxy => {
662
- console.log("scenePath", scenePath, appProxy.scenePath);
663
662
  if (appProxy.scenePath && scenePath.startsWith(appProxy.scenePath)) {
664
663
  appProxy.emitAppSceneStateChange(sceneState);
665
664
  appProxy.setFullPath(scenePath);
@@ -53,7 +53,7 @@ export class ReconnectRefresher {
53
53
 
54
54
  private onReconnected = debounce(() => {
55
55
  this._onReconnected();
56
- }, 3000);
56
+ }, 1000);
57
57
 
58
58
  private _onReconnected = () => {
59
59
  log("onReconnected refresh reactors");
@@ -56,6 +56,9 @@ export const replaceRoomFunction = (room: Room | Player, manager: WindowManager)
56
56
  room.lockImages = (...args) => manager.lockImages(...args);
57
57
 
58
58
  delegateRemoveScenes(room, manager);
59
+ if (!(room as any).dynamicPpt.slideStateAdapter.pptHandler) {
60
+ (room as any).dynamicPpt.slideStateAdapter.pptHandler = manager.createPPTHandler();
61
+ }
59
62
  }
60
63
  };
61
64
 
@@ -5,7 +5,7 @@ import { emitter } from "../InternalEmitter";
5
5
  import { Events } from "../constants";
6
6
  import { Fields } from "../AttributesDelegate";
7
7
  import { reaction, toJS } from "white-web-sdk";
8
- import { releaseView, setViewFocusScenePath } from "../Utils/Common";
8
+ import { releaseView, setScenePath, setViewFocusScenePath } from "../Utils/Common";
9
9
  import { SideEffectManager } from "side-effect-manager";
10
10
  import { Val } from "value-enhancer";
11
11
  import { ViewSync } from "./ViewSync";
@@ -41,6 +41,14 @@ export class MainViewProxy {
41
41
  }),
42
42
  ]);
43
43
  this.createViewSync();
44
+ this.sideEffectManager.add(() => emitter.on("focusedChange", ({ focused }) => {
45
+ if (focused === undefined) {
46
+ const scenePath = this.store.getMainViewScenePath();
47
+ if (scenePath) {
48
+ setScenePath(this.manager.room, scenePath);
49
+ }
50
+ }
51
+ }));
44
52
  }
45
53
 
46
54
  public createViewSync = () => {
@@ -35,9 +35,10 @@ export class ViewSync {
35
35
  const iCamera = {
36
36
  id: this.context.uid,
37
37
  ...camera,
38
- }
38
+ };
39
39
  this.context.camera$.setValue(iCamera, true);
40
- const notStoreCamera = this.context.viewMode$ && this.context.viewMode$.value === ViewMode.Freedom;
40
+ const notStoreCamera =
41
+ this.context.viewMode$ && this.context.viewMode$.value === ViewMode.Freedom;
41
42
  if (notStoreCamera) {
42
43
  return;
43
44
  } else {
@@ -54,8 +55,8 @@ export class ViewSync {
54
55
  animationMode: AnimationMode.Immediately,
55
56
  });
56
57
  this.synchronizer.onRemoteUpdate(currentCamera, this.context.size$.value);
57
- }
58
-
58
+ }
59
+
59
60
  this.bindView(view);
60
61
  })
61
62
  );
@@ -74,18 +75,15 @@ export class ViewSync {
74
75
  }
75
76
  })
76
77
  );
77
- if (this.context.stageRect$.value) {
78
- this.synchronizer.setRect(this.context.stageRect$.value);
79
- this.sem.add(() =>
80
- this.context.stageRect$.subscribe(rect => {
81
- if (rect) {
82
- this.synchronizer.setRect(rect);
83
- }
84
- })
85
- );
86
- }
78
+ this.sem.add(() =>
79
+ this.context.stageRect$.reaction(rect => {
80
+ if (rect) {
81
+ this.synchronizer.setRect(rect);
82
+ }
83
+ })
84
+ );
87
85
  const camera$size$ = combine([this.context.camera$, this.context.size$]);
88
- camera$size$.subscribe(([camera, size]) => {
86
+ camera$size$.reaction(([camera, size]) => {
89
87
  if (camera && size) {
90
88
  this.synchronizer.onRemoteUpdate(camera, size);
91
89
  camera$size$.destroy();
package/src/index.ts CHANGED
@@ -923,6 +923,24 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> imple
923
923
  emitter.emit("containerSizeRatioUpdate", ratio);
924
924
  }
925
925
 
926
+ public createPPTHandler() {
927
+ return {
928
+ onPageJumpTo: (_pptUUID: string, index: number) => {
929
+ this.appManager?.focusApp?.appContext?.whiteBoardView?.jumpPage(index);
930
+ },
931
+ onPageToNext: () => {
932
+ if (this.focused) {
933
+ this.appManager?.focusApp?.appContext?.whiteBoardView?.nextPage();
934
+ }
935
+ },
936
+ onPageToPrev: () => {
937
+ if (this.focused) {
938
+ this.appManager?.focusApp?.appContext?.whiteBoardView?.prevPage();
939
+ }
940
+ }
941
+ }
942
+ }
943
+
926
944
  private isDynamicPPT(scenes: SceneDefinition[]) {
927
945
  const sceneSrc = scenes[0]?.ppt?.src;
928
946
  return sceneSrc?.startsWith("pptx://");