@netless/window-manager 1.0.13-beta.1 → 1.0.13-test.2

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.13-beta.1",
3
+ "version": "1.0.13-test.2",
4
4
  "description": "Multi-window mode for Netless Whiteboard",
5
5
  "author": "l1shen <lishen1635@gmail.com> (https://github.com/l1shen)",
6
6
  "license": "MIT",
@@ -47,6 +47,7 @@ export class AppListeners {
47
47
  break;
48
48
  }
49
49
  case Events.SetMainViewScenePath: {
50
+ console.log("[window-manager] mainMagixEventListener====>", JSON.stringify(data.payload));
50
51
  this.setMainViewScenePathHandler(data.payload);
51
52
  break;
52
53
  }
package/src/AppManager.ts CHANGED
@@ -51,6 +51,7 @@ import type {
51
51
  } from "./BoxEmitter";
52
52
  import { getExtendClass } from "./Utils/extendClass";
53
53
  import type { TeleBoxState } from "@netless/telebox-insider";
54
+ import { getAttribute } from "video.js/dist/types/utils/dom";
54
55
 
55
56
  export class AppManager {
56
57
  static readonly kind = "AppManager";
@@ -840,6 +841,7 @@ export class AppManager {
840
841
  throw new Error(`[WindowManager]: ${scenePath} not valid scene`);
841
842
  } else if (scenePathType === ScenePathType.Page) {
842
843
  await this._setMainViewScenePath(scenePath);
844
+
843
845
  } else if (scenePathType === ScenePathType.Dir) {
844
846
  const validScenePath = makeValidScenePath(this.displayer, scenePath);
845
847
  if (validScenePath) {
@@ -852,6 +854,7 @@ export class AppManager {
852
854
  private async _setMainViewScenePath(scenePath: string) {
853
855
  const success = this.setMainViewFocusPath(scenePath);
854
856
  if (success) {
857
+ console.log("[window-manager] _setMainViewScenePath====>", scenePath);
855
858
  this.safeSetAttributes({ _mainScenePath: scenePath });
856
859
  this.store.setMainViewFocusPath(this.mainView);
857
860
  this.updateSceneIndex();
@@ -868,6 +871,7 @@ export class AppManager {
868
871
  const pageName = scenePath.replace(sceneDir, "").replace("/", "");
869
872
  const index = scenes.findIndex(scene => scene.name === pageName);
870
873
  if (isInteger(index) && index >= 0) {
874
+ console.log("[window-manager] updateSceneIndex====>", index);
871
875
  this.safeSetAttributes({ _mainSceneIndex: index });
872
876
  }
873
877
  }
@@ -893,6 +897,7 @@ export class AppManager {
893
897
  }
894
898
 
895
899
  private dispatchSetMainViewScenePath(scenePath: string): void {
900
+ console.log("[window-manager] dispatchSetMainViewScenePath====>", JSON.stringify(scenePath));
896
901
  this.dispatchInternalEvent(Events.SetMainViewScenePath, { nextScenePath: scenePath });
897
902
  callbacks.emit("mainViewScenePathChange", scenePath);
898
903
  // 兼容 15 的 SDK, 需要 room 的当前 ScenePath
@@ -973,3 +978,4 @@ export class AppManager {
973
978
  this._resolveTimer = undefined;
974
979
  }
975
980
  }
981
+
@@ -194,10 +194,12 @@ export class AttributesDelegate {
194
194
  }
195
195
 
196
196
  public setMainViewScenePath(scenePath: string) {
197
+ console.log("[window-manager] setMainViewScenePath====>", scenePath);
197
198
  this.context.safeSetAttributes({ _mainScenePath: scenePath });
198
199
  }
199
200
 
200
201
  public setMainViewSceneIndex(index: number) {
202
+ console.log("[window-manager] setMainViewSceneIndex====>", index);
201
203
  this.context.safeSetAttributes({ _mainSceneIndex: index });
202
204
  }
203
205
 
@@ -210,16 +212,19 @@ export class AttributesDelegate {
210
212
  }
211
213
 
212
214
  public setMainViewCamera(camera: ICamera) {
215
+ console.log("[window-manager] setMainViewCamera====>", JSON.stringify(camera));
213
216
  this.context.safeSetAttributes({ [Fields.MainViewCamera]: { ...camera } });
214
217
  }
215
218
 
216
219
  public setMainViewSize(size: ISize) {
217
220
  if (size.width === 0 || size.height === 0) return;
221
+ console.log("[window-manager] setMainViewSize====>", JSON.stringify(size));
218
222
  this.context.safeSetAttributes({ [Fields.MainViewSize]: { ...size } });
219
223
  }
220
224
 
221
225
  public setMainViewCameraAndSize(camera: ICamera, size: ISize) {
222
226
  if (size.width === 0 || size.height === 0) return;
227
+ console.log("[window-manager] setMainViewCameraAndSize====>", JSON.stringify(camera), JSON.stringify(size));
223
228
  this.context.safeSetAttributes({
224
229
  [Fields.MainViewCamera]: { ...camera },
225
230
  [Fields.MainViewSize]: { ...size },
@@ -34,6 +34,7 @@ export const setScenePath = (room: Room | undefined, scenePath: string) => {
34
34
  if (room && room.isWritable) {
35
35
  if (room.state.sceneState.scenePath !== scenePath) {
36
36
  const nextScenePath = scenePath === "/" ? "" : scenePath;
37
+ console.log("[window-manager] real setScenePath for current room====>", nextScenePath);
37
38
  room.setScenePath(nextScenePath);
38
39
  }
39
40
  }
@@ -33,7 +33,11 @@ export const replaceRoomFunction = (room: Room | Player, manager: WindowManager)
33
33
  return manager.canRedoSteps;
34
34
  },
35
35
  });
36
-
36
+ const _scalePptToFit = room.scalePptToFit;
37
+ room.scalePptToFit = (...args) => {
38
+ console.log("[window-manager] scalePptToFit====>", JSON.stringify(args));
39
+ _scalePptToFit.call(room, ...args);
40
+ };
37
41
  room.moveCamera = (camera: Camera) => manager.moveCamera(camera);
38
42
  room.moveCameraToContain = (...args) => manager.moveCameraToContain(...args);
39
43
  room.convertToPointInWorld = (...args) => manager.mainView.convertToPointInWorld(...args);
@@ -33,6 +33,7 @@ export class MainViewProxy {
33
33
  this.startListenWritableChange();
34
34
  });
35
35
  const playgroundSizeChangeListener = () => {
36
+ console.log("[window-manager] playgroundSizeChangeListener====>", JSON.stringify(this.mainViewSize));
36
37
  this.sizeChangeHandler(this.mainViewSize);
37
38
  };
38
39
  this.sideEffectManager.add(() => {
@@ -97,6 +98,7 @@ export class MainViewProxy {
97
98
  }
98
99
 
99
100
  public start() {
101
+ console.log("[window-manager] start====>", JSON.stringify(this.mainViewSize));
100
102
  this.sizeChangeHandler(this.mainViewSize);
101
103
  if (this.started) return;
102
104
  this.addCameraListener();
@@ -120,6 +122,7 @@ export class MainViewProxy {
120
122
  () => this.mainViewCamera,
121
123
  camera => {
122
124
  if (camera && camera.id !== this.manager.uid) {
125
+ console.log("[window-manager] cameraReaction====>", JSON.stringify(camera), JSON.stringify(this.mainViewSize));
123
126
  this.moveCameraToContian(this.mainViewSize);
124
127
  this.moveCamera(camera);
125
128
  }
@@ -132,12 +135,14 @@ export class MainViewProxy {
132
135
  if (size) {
133
136
  this.moveCameraToContian(size);
134
137
  this.moveCamera(this.mainViewCamera);
138
+ console.log("[window-manager] sizeChangeHandler====> current size and camera", JSON.stringify(size), JSON.stringify(this.mainViewCamera));
135
139
  }
136
140
  this.ensureMainViewSize();
137
141
  }, 30);
138
142
 
139
143
  public onUpdateContainerSizeRatio = () => {
140
144
  const size = this.store.getMainViewSize();
145
+ console.log("[window-manager] onUpdateContainerSizeRatio====>", JSON.stringify(size));
141
146
  this.sizeChangeHandler(size);
142
147
  };
143
148
 
@@ -249,6 +254,7 @@ export class MainViewProxy {
249
254
  clearTimeout(this._syncMainViewTimer);
250
255
  this._syncMainViewTimer = setTimeout(this.syncMainView, 100, this.manager.room);
251
256
  }
257
+ console.log("[window-manager] onCameraOrSizeUpdated====>", JSON.stringify(this.cameraState));
252
258
  this.ensureMainViewSize();
253
259
  };
254
260
 
@@ -266,6 +272,7 @@ export class MainViewProxy {
266
272
 
267
273
  private syncMainView = (room: Room) => {
268
274
  if (room.isWritable) {
275
+ console.log("[window-manager] syncMainView====>");
269
276
  room.syncMainView(this.mainView);
270
277
  }
271
278
  };