@netless/window-manager 1.0.13-test.17 → 1.0.13-test.19

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-test.17",
3
+ "version": "1.0.13-test.19",
4
4
  "description": "Multi-window mode for Netless Whiteboard",
5
5
  "author": "l1shen <lishen1635@gmail.com> (https://github.com/l1shen)",
6
6
  "license": "MIT",
package/src/AppManager.ts CHANGED
@@ -146,7 +146,7 @@ export class AppManager {
146
146
  const { scenePath } = params;
147
147
  // 如果移除根目录就把 scenePath 设置为初始值
148
148
  if (scenePath === ROOT_DIR) {
149
- console.log("[window-manager] onRemoveScenes ROOT_DIR");
149
+ console.log("[window-manager] onRemoveScenes ROOT_DIR");
150
150
  await this.onRootDirRemoved();
151
151
  this.dispatchInternalEvent(Events.RootDirRemoved);
152
152
  return;
@@ -159,7 +159,7 @@ export class AppManager {
159
159
  sceneName = this.callbacksNode?.scenes[nextIndex];
160
160
  }
161
161
  if (sceneName) {
162
- console.log("[window-manager] onRemoveScenes setMainViewScenePath" + `${ROOT_DIR}${sceneName}`);
162
+ console.log(`[window-manager] onRemoveScenes setMainViewScenePath ${ROOT_DIR}${sceneName}`);
163
163
  this.setMainViewScenePath(`${ROOT_DIR}${sceneName}`);
164
164
  }
165
165
  await this.setMainViewSceneIndex(nextIndex);
@@ -713,11 +713,12 @@ export class AppManager {
713
713
  callbacks.emit("onMainViewMounted", mainView);
714
714
  const hasRoot = this.hasRoot(mainView.divElement);
715
715
  const rect = this.getRectByDivElement(mainView.divElement);
716
- console.log("[window-manager] bindMainView hasRoot" + hasRoot + JSON.stringify(rect) +
717
- window.outerHeight + window.outerWidth,
718
- window.visualViewport?.width ?? "null", window.visualViewport?.height ?? "null",
719
- window.visualViewport?.offsetLeft ?? "null", window.visualViewport?.offsetTop ?? "null",
720
- );
716
+ let log = `[window-manager] bindMainView hasRoot:${hasRoot}, rect:${JSON.stringify(rect)}, outerHeight:${window.outerHeight}, outerWidth:${window.outerWidth}`;
717
+ const visualViewport = window.visualViewport;
718
+ if (visualViewport) {
719
+ log += `, visualViewportWidth:${visualViewport.width}, visualViewportHeight:${visualViewport.height}, visualViewportOffsetLeft:${visualViewport.offsetLeft}, visualViewportOffsetTop:${visualViewport.offsetTop}`;
720
+ }
721
+ console.log(log);
721
722
  }
722
723
 
723
724
  private hasRoot(divElement: HTMLDivElement){
@@ -879,7 +880,7 @@ export class AppManager {
879
880
  private async _setMainViewScenePath(scenePath: string) {
880
881
  const success = this.setMainViewFocusPath(scenePath);
881
882
  if (success) {
882
- console.log("[window-manager] _setMainViewScenePath ", scenePath);
883
+ console.log("[window-manager] _setMainViewScenePath " + scenePath);
883
884
  this.safeSetAttributes({ _mainScenePath: scenePath });
884
885
  this.store.setMainViewFocusPath(this.mainView);
885
886
  this.updateSceneIndex();
@@ -896,7 +897,7 @@ export class AppManager {
896
897
  const pageName = scenePath.replace(sceneDir, "").replace("/", "");
897
898
  const index = scenes.findIndex(scene => scene.name === pageName);
898
899
  if (isInteger(index) && index >= 0) {
899
- console.log("[window-manager] updateSceneIndex ", index);
900
+ console.log("[window-manager] updateSceneIndex " + index);
900
901
  this.safeSetAttributes({ _mainSceneIndex: index });
901
902
  }
902
903
  }
@@ -922,7 +923,6 @@ export class AppManager {
922
923
  }
923
924
 
924
925
  private dispatchSetMainViewScenePath(scenePath: string): void {
925
- console.log("[window-manager] dispatchSetMainViewScenePath ", JSON.stringify(scenePath));
926
926
  this.dispatchInternalEvent(Events.SetMainViewScenePath, { nextScenePath: scenePath });
927
927
  callbacks.emit("mainViewScenePathChange", scenePath);
928
928
  // 兼容 15 的 SDK, 需要 room 的当前 ScenePath
@@ -55,7 +55,7 @@ export type ISize = Size & { id: string };
55
55
 
56
56
  export class AttributesDelegate {
57
57
  static readonly kind = "AttributesDelegate";
58
- private setMainViewCameraConsole = new LocalConsole("setMainViewCamera", 50);
58
+ private setMainViewCameraConsole = new LocalConsole("setMainViewCamera", 30);
59
59
  constructor(private context: StoreContext) {}
60
60
 
61
61
  public setContext(context: StoreContext) {
@@ -196,12 +196,12 @@ export class AttributesDelegate {
196
196
  }
197
197
 
198
198
  public setMainViewScenePath(scenePath: string) {
199
- console.log("[window-manager] setMainViewScenePath ", scenePath);
199
+ console.log("[window-manager] setMainViewScenePath " + scenePath);
200
200
  this.context.safeSetAttributes({ _mainScenePath: scenePath });
201
201
  }
202
202
 
203
203
  public setMainViewSceneIndex(index: number) {
204
- console.log("[window-manager] setMainViewSceneIndex ", index);
204
+ console.log("[window-manager] setMainViewSceneIndex " + index);
205
205
  this.context.safeSetAttributes({ _mainSceneIndex: index });
206
206
  }
207
207
 
@@ -220,13 +220,13 @@ export class AttributesDelegate {
220
220
 
221
221
  public setMainViewSize(size: ISize) {
222
222
  if (size.width === 0 || size.height === 0) return;
223
- console.log("[window-manager] setMainViewSize ", JSON.stringify(size));
223
+ console.log("[window-manager] setMainViewSize size:" + JSON.stringify(size));
224
224
  this.context.safeSetAttributes({ [Fields.MainViewSize]: { ...size } });
225
225
  }
226
226
 
227
227
  public setMainViewCameraAndSize(camera: ICamera, size: ISize) {
228
228
  if (size.width === 0 || size.height === 0) return;
229
- console.log("[window-manager] setMainViewCameraAndSize ", JSON.stringify(camera), JSON.stringify(size));
229
+ console.log("[window-manager] setMainViewCameraAndSize camera:" + JSON.stringify(camera) + ", size:" + JSON.stringify(size));
230
230
  this.context.safeSetAttributes({
231
231
  [Fields.MainViewCamera]: { ...camera },
232
232
  [Fields.MainViewSize]: { ...size },
package/src/BoxManager.ts CHANGED
@@ -420,7 +420,6 @@ export class BoxManager {
420
420
  const rect = this.mainView.divElement?.getBoundingClientRect();
421
421
  if (rect && rect.width > 0 && rect.height > 0) {
422
422
  const containerRect = { x: 0, y: 0, width: rect.width, height: rect.height };
423
- console.log("[window-manager] updateManagerRect" + JSON.stringify(containerRect) + "mainView" + this.mainView.size);
424
423
  this.teleBoxManager.setContainerRect(containerRect);
425
424
  this.context.notifyContainerRectUpdate(this.teleBoxManager.containerRect);
426
425
  }
@@ -3,12 +3,15 @@ import { isFunction } from "lodash";
3
3
  import { WindowManager } from "./index";
4
4
  import type { EmitterType } from "./InternalEmitter";
5
5
  import type { UnsubscribeFn } from "emittery";
6
+ import { LocalConsole } from "./Utils/log";
6
7
 
7
8
  const ResizeObserver = window.ResizeObserver || ResizeObserverPolyfill;
8
9
 
9
10
  export class ContainerResizeObserver {
10
11
  private containerResizeObserver?: ResizeObserver;
11
12
  private disposer?: UnsubscribeFn;
13
+
14
+ private updateSizerLocalConsole = new LocalConsole("updateSizer", 30);
12
15
 
13
16
  constructor(private emitter: EmitterType) {}
14
17
 
@@ -28,21 +31,18 @@ export class ContainerResizeObserver {
28
31
  sizer: HTMLElement,
29
32
  wrapper: HTMLDivElement
30
33
  ) {
31
- console.log(`[window-manager] observePlaygroundSize ${JSON.stringify(container.getBoundingClientRect())}, ${JSON.stringify(sizer.getBoundingClientRect())}, ${JSON.stringify(wrapper.getBoundingClientRect())}`);
32
34
  this.updateSizer(container.getBoundingClientRect(), sizer, wrapper, 'observePlaygroundSize');
33
35
 
34
36
  this.containerResizeObserver = new ResizeObserver(entries => {
35
37
  const containerRect = entries[0]?.contentRect;
36
38
  if (containerRect) {
37
39
  this.updateSizer(containerRect, sizer, wrapper, 'containerResizeObserver');
38
- console.log(`[window-manager] containerResizeObserver ${JSON.stringify(containerRect)}`);
39
40
  this.emitter.emit("playgroundSizeChange", containerRect);
40
41
  }
41
42
  });
42
43
 
43
44
  this.disposer = this.emitter.on("containerSizeRatioUpdate", () => {
44
45
  const containerRect = container.getBoundingClientRect();
45
- console.log(`[window-manager] containerSizeRatioUpdate ${JSON.stringify(containerRect)}`);
46
46
  this.updateSizer(containerRect, sizer, wrapper, 'containerSizeRatioUpdate');
47
47
  this.emitter.emit("playgroundSizeChange", containerRect);
48
48
  });
@@ -66,9 +66,8 @@ export class ContainerResizeObserver {
66
66
  }
67
67
  wrapper.style.width = `${width}px`;
68
68
  wrapper.style.height = `${height}px`;
69
- wrapper.style.backgroundColor = 'green';
70
69
  const wrapperRect = wrapper.getBoundingClientRect();
71
- console.log(`[window-manager] updateSizer from ${origin}: ${JSON.stringify({ width, height })} ${wrapper.style.width} ${wrapper.style.height} ${JSON.stringify(wrapperRect)}`);
70
+ this.updateSizerLocalConsole.log(`from ${origin}, traget size: ${JSON.stringify({ width, height })}, wrapperRect: ${wrapperRect.width} ${wrapperRect.height}`);
72
71
  this.emitter.emit("wrapperRectChange", {
73
72
  width: wrapperRect.width,
74
73
  height: wrapperRect.height,
@@ -34,7 +34,6 @@ 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);
38
37
  room.setScenePath(nextScenePath);
39
38
  }
40
39
  }
@@ -37,10 +37,24 @@ export const replaceRoomFunction = (room: Room | Player, manager: WindowManager)
37
37
  room.scalePptToFit = (...args) => {
38
38
  _scalePptToFit.call(room, ...args);
39
39
  if (manager.appManager?.mainViewProxy) {
40
- console.log("[window-manager] scalePptToFit " + JSON.stringify(args));
41
40
  manager.appManager.mainViewProxy.setCameraAndSize();
42
41
  }
43
42
  };
43
+ const _putScenes = room.putScenes;
44
+ room.putScenes = (...args) => {
45
+ const [path, scenes] = args;
46
+ const currentScenePath = manager.mainView.focusScenePath;
47
+ if (currentScenePath && path && scenes) {
48
+ console.log("[window-manager] putScenes " + JSON.stringify(args));
49
+ for (const scene of scenes) {
50
+ if (`${path}${scene.name}` === currentScenePath) {
51
+ console.error(`[window-manager] putScenes: scene name can not be the same as the current scene path: ${currentScenePath}`);
52
+ return;
53
+ }
54
+ }
55
+ }
56
+ return _putScenes.call(room, ...args);
57
+ };
44
58
  room.moveCamera = (camera: Camera) => manager.moveCamera(camera);
45
59
  room.moveCameraToContain = (...args) => manager.moveCameraToContain(...args);
46
60
  room.convertToPointInWorld = (...args) => manager.mainView.convertToPointInWorld(...args);
@@ -19,8 +19,6 @@ export class MainViewProxy {
19
19
  private scale?: number;
20
20
  private started = false;
21
21
  private mainViewIsAddListener = false;
22
- private mainViewResizeObserver?: ResizeObserver;
23
- private mainViewResizeObserver2?: ResizeObserver;
24
22
  private isForcingMainViewDivElement = false;
25
23
  private wrapperRectWorkaroundFrame = 0;
26
24
  private pendingWrapperRectChange?: { width: number; height: number; origin?: string };
@@ -31,19 +29,19 @@ export class MainViewProxy {
31
29
  private sideEffectManager = new SideEffectManager();
32
30
 
33
31
  private playgroundSizeChangeListenerLocalConsole = new LocalConsole("playgroundSizeChangeListener", 30);
32
+ private sizeUpdatedLocalConsole = new LocalConsole("sizeUpdated", 30);
33
+ private cameraUpdatedLocalConsole = new LocalConsole("cameraUpdated", 30);
34
34
 
35
35
  constructor(private manager: AppManager) {
36
36
  this.mainView = this.createMainView();
37
37
  this.moveCameraSizeByAttributes();
38
38
  internalEmitter.once("mainViewMounted").then(() => {
39
- this.observeMainViewDivElement();
40
39
  this.addMainViewListener();
41
40
  this.start();
42
41
  this.ensureCameraAndSize();
43
42
  this.startListenWritableChange();
44
43
  });
45
44
  const playgroundSizeChangeListener = () => {
46
- // this.refreshScreenSizeIfStale();
47
45
  this.playgroundSizeChangeListenerLocalConsole.log(
48
46
  JSON.stringify(this.mainView.camera),
49
47
  JSON.stringify(this.mainView.size),
@@ -61,9 +59,9 @@ export class MainViewProxy {
61
59
  this.sideEffectManager.add(() => {
62
60
  return internalEmitter.on("containerSizeRatioUpdate", this.onUpdateContainerSizeRatio);
63
61
  });
64
- // this.sideEffectManager.add(() => {
65
- // return internalEmitter.on("wrapperRectChange", this.onWrapperRectChange);
66
- // });
62
+ this.sideEffectManager.add(() => {
63
+ return internalEmitter.on("wrapperRectChange", this.onWrapperRectChange);
64
+ });
67
65
  this.sideEffectManager.add(() => {
68
66
  return internalEmitter.on("startReconnect", () => {
69
67
  if (!this.didRelease) {
@@ -119,21 +117,8 @@ export class MainViewProxy {
119
117
  this.moveCamera(this.mainViewCamera);
120
118
  }
121
119
 
122
- private refreshScreenSizeIfStale() {
123
- const element = this.mainView.divElement;
124
- if (!element) return;
125
-
126
- const { width, height } = element.getBoundingClientRect();
127
- if (width <= 0 || height <= 0) return;
128
- this.forceSyncMainViewDivElement("playgroundSizeChange", { width, height }, element);
129
- }
130
-
131
120
  private onWrapperRectChange = (payload: { width: number; height: number; origin?: string }) => {
132
121
  this.pendingWrapperRectChange = payload;
133
- console.log("[window-manager] onWrapperRectChange " + JSON.stringify({
134
- ...payload,
135
- viewSize: this.mainView.size,
136
- }));
137
122
  if (this.wrapperRectWorkaroundFrame) {
138
123
  cancelAnimationFrame(this.wrapperRectWorkaroundFrame);
139
124
  }
@@ -156,15 +141,6 @@ export class MainViewProxy {
156
141
  Math.abs(this.mainView.size.width - observedSize.width) > 0.5 ||
157
142
  Math.abs(this.mainView.size.height - observedSize.height) > 0.5;
158
143
 
159
- console.log("[window-manager] runWrapperRectWorkaround " + JSON.stringify({
160
- origin: payload.origin,
161
- wrapperRect: payload,
162
- domRect: observedSize,
163
- viewSize: this.mainView.size,
164
- wrapperMatchesDom,
165
- viewIsStale,
166
- }));
167
-
168
144
  if (wrapperMatchesDom && viewIsStale) {
169
145
  this.forceSyncMainViewDivElement(
170
146
  `wrapperRectChange:${payload.origin || "unknown"}`,
@@ -216,14 +192,17 @@ export class MainViewProxy {
216
192
  }
217
193
 
218
194
  public start() {
219
- console.log("[window-manager] start " + JSON.stringify(this.mainViewSize));
195
+ console.log("[window-manager] start attributes size:" + JSON.stringify(this.mainViewSize));
220
196
  this.sizeChangeHandler(this.mainViewSize);
221
197
  if (this.started) return;
222
198
  this.addCameraListener();
223
199
  this.addCameraReaction();
224
200
  if (this.manager.room) this.syncMainView(this.manager.room);
225
201
  this.started = true;
226
- console.log("[window-manager] start end " + JSON.stringify(this.mainViewSize), JSON.stringify(this.mainView.size));
202
+ if(this.mainView.focusScenePath) {
203
+ this.manager.windowManger.onMainViewScenePathChangeHandler(this.mainView.focusScenePath);
204
+ }
205
+ console.log("[window-manager] start end mainView size:" + JSON.stringify(this.mainView.size));
227
206
  }
228
207
 
229
208
  public addCameraReaction = () => {
@@ -254,7 +233,7 @@ export class MainViewProxy {
254
233
  if (size) {
255
234
  this.moveCameraToContian(size);
256
235
  this.moveCamera(this.mainViewCamera);
257
- console.log("[window-manager] sizeChangeHandler current size and camera" + JSON.stringify(size) + JSON.stringify(this.mainViewCamera) +
236
+ console.log("[window-manager] sizeChangeHandler current size and camera" + JSON.stringify(size) + JSON.stringify(this.mainViewCamera) +
258
237
  JSON.stringify(this.mainView.camera) + JSON.stringify(this.mainView.size));
259
238
  }
260
239
  this.ensureMainViewSize();
@@ -306,11 +285,9 @@ export class MainViewProxy {
306
285
  this.mainView.release();
307
286
  }
308
287
  this.removeMainViewListener();
309
- this.disconnectMainViewResizeObserver();
310
288
  this.mainView = this.createMainView();
311
289
  this.mainView.disableCameraTransform = disableCameraTransform;
312
290
  this.mainView.divElement = divElement;
313
- this.observeMainViewDivElement();
314
291
  this.addMainViewListener();
315
292
  this.start();
316
293
  callbacks.emit("onMainViewRebind", this.mainView);
@@ -367,117 +344,8 @@ export class MainViewProxy {
367
344
  this.view.callbacks.off("onSizeUpdated", this.onSizeUpdated);
368
345
  }
369
346
 
370
- private observeMainViewDivElement() {
371
- this.disconnectMainViewResizeObserver();
372
- if (!("ResizeObserver" in window)) return;
373
- if (!this.mainView.divElement) return;
374
- console.log("[window-manager] observeMainViewDivElement " + JSON.stringify({
375
- rect: this.mainView.divElement.getBoundingClientRect(),
376
- viewSize: this.mainView.size,
377
- }));
378
- this.mainViewResizeObserver = new window.ResizeObserver(this.onResize);
379
- this.mainViewResizeObserver.observe(this.mainView.divElement);
380
- this.mainViewResizeObserver2 = new window.ResizeObserver(this.onResize2);
381
- this.mainViewResizeObserver2.observe(this.mainView.divElement);
382
- }
383
-
384
- private disconnectMainViewResizeObserver() {
385
- this.mainViewResizeObserver?.disconnect();
386
- this.mainViewResizeObserver = undefined;
387
- this.mainViewResizeObserver2?.disconnect();
388
- this.mainViewResizeObserver2 = undefined;
389
- }
390
-
391
- private onResize = (entries: ResizeObserverEntry[]) => {
392
- const entry = entries[0];
393
- if (!entry) return;
394
- const target = entry.target as HTMLDivElement;
395
- const child = target.children[0] as HTMLElement | undefined;
396
- const observedSize = {
397
- width: entry.contentRect.width,
398
- height: entry.contentRect.height,
399
- };
400
- console.log("[window-manager] mainViewResizeObserver " + JSON.stringify({
401
- sameTarget: target === this.mainView.divElement,
402
- contentRect: {
403
- width: observedSize.width,
404
- height: observedSize.height,
405
- },
406
- client: {
407
- width: target.clientWidth,
408
- height: target.clientHeight,
409
- },
410
- offset: {
411
- width: target.offsetWidth,
412
- height: target.offsetHeight,
413
- },
414
- rect: {
415
- width: target.getBoundingClientRect().width,
416
- height: target.getBoundingClientRect().height,
417
- },
418
- childRect: child
419
- ? {
420
- width: child.getBoundingClientRect().width,
421
- height: child.getBoundingClientRect().height,
422
- }
423
- : null,
424
- viewSize: this.mainView.size,
425
- }));
426
- // this.forceSyncMainViewDivElement("mainViewResizeObserver", observedSize, target);
427
- };
428
-
429
- private onResize2 = (entries: ResizeObserverEntry[]) => {
430
- const entry = entries[0];
431
- if (!entry) return;
432
- const target = entry.target as HTMLDivElement;
433
- const child = target.children[0] as HTMLElement | undefined;
434
- const observedSize = {
435
- width: entry.contentRect.width,
436
- height: entry.contentRect.height,
437
- };
438
- console.log("[window-manager] mainViewResizeObserver2 " + JSON.stringify({
439
- sameTarget: target === this.mainView.divElement,
440
- contentRect: {
441
- width: observedSize.width,
442
- height: observedSize.height,
443
- },
444
- client: {
445
- width: target.clientWidth,
446
- height: target.clientHeight,
447
- },
448
- offset: {
449
- width: target.offsetWidth,
450
- height: target.offsetHeight,
451
- },
452
- rect: {
453
- width: target.getBoundingClientRect().width,
454
- height: target.getBoundingClientRect().height,
455
- },
456
- childRect: child
457
- ? {
458
- width: child.getBoundingClientRect().width,
459
- height: child.getBoundingClientRect().height,
460
- }
461
- : null,
462
- viewSize: this.mainView.size,
463
- }));
464
- };
465
-
466
347
  private _syncMainViewTimer = 0;
467
- private handleCameraOrSizeUpdated = (
468
- source: "onCameraUpdated" | "onSizeUpdated",
469
- payload: Camera | Size
470
- ) => {
471
- console.log("[window-manager] " + source + " payload " + JSON.stringify(payload));
472
- console.log("[window-manager] " + source + " state " + JSON.stringify(this.cameraState));
473
- if(this.mainView.divElement){
474
- const children = this.mainView.divElement.children;
475
- console.log("[window-manager] " + source + " rect " + JSON.stringify(this.mainView.divElement.getBoundingClientRect()));
476
- const child = children[0];
477
- if (child) {
478
- console.log("[window-manager] " + source + " child" + JSON.stringify(child.getBoundingClientRect()));
479
- }
480
- }
348
+ private handleCameraOrSizeUpdated = () => {
481
349
  callbacks.emit("cameraStateChange", this.cameraState);
482
350
  // sdk >= 2.16.43 的 syncMainView() 可以写入当前 main view 的 camera, 以修复复制粘贴元素的位置
483
351
  // 注意到这个操作会发送信令,应当避免频繁调用
@@ -489,11 +357,13 @@ export class MainViewProxy {
489
357
  };
490
358
 
491
359
  private onCameraUpdated = (camera: Camera) => {
492
- this.handleCameraOrSizeUpdated("onCameraUpdated", camera);
360
+ this.cameraUpdatedLocalConsole.log(JSON.stringify(camera));
361
+ this.handleCameraOrSizeUpdated();
493
362
  };
494
363
 
495
364
  private onSizeUpdated = (size: Size) => {
496
- this.handleCameraOrSizeUpdated("onSizeUpdated", size);
365
+ this.sizeUpdatedLocalConsole.log(JSON.stringify(size));
366
+ this.handleCameraOrSizeUpdated();
497
367
  };
498
368
 
499
369
  private ensureMainViewSize() {
@@ -510,7 +380,7 @@ export class MainViewProxy {
510
380
 
511
381
  private syncMainView = (room: Room) => {
512
382
  if (room.isWritable) {
513
- console.log("[window-manager] syncMainView ");
383
+ console.log("[window-manager] syncMainView ");
514
384
  room.syncMainView(this.mainView);
515
385
  }
516
386
  };
@@ -560,7 +430,6 @@ export class MainViewProxy {
560
430
  this.wrapperRectWorkaroundFrame = 0;
561
431
  }
562
432
  this.removeMainViewListener();
563
- this.disconnectMainViewResizeObserver();
564
433
  this.stop();
565
434
  this.sideEffectManager.flushAll();
566
435
  }
package/src/index.ts CHANGED
@@ -403,16 +403,17 @@ export class WindowManager
403
403
  if (mainViewElement) {
404
404
  const backgroundImage = mainViewElement.querySelector('.background img');
405
405
  if (backgroundImage) {
406
- // todo 获取到 back ground image 的 rect情况以及css情况是否可见
407
406
  const backgroundImageRect = backgroundImage?.getBoundingClientRect();
408
407
  const backgroundImageCSS = window.getComputedStyle(backgroundImage);
409
408
  const backgroundImageVisible = backgroundImageRect?.width > 0 && backgroundImageRect?.height > 0 && backgroundImageCSS.display !== 'none';
410
- console.log("[window-manager] backgroundImageVisible" + backgroundImageVisible);
409
+ const camera = this.mainView.camera;
410
+ console.log("[window-manager] backgroundImageVisible:" + backgroundImageVisible + " camera:" + JSON.stringify(camera));
411
411
  return;
412
412
  }
413
- console.log("[window-manager] onMainViewScenePathChange" + scenePath + 'backgroundImageVisible is not found');
413
+ console.log("[window-manager] onMainViewScenePathChange scenePath:" + scenePath + ' backgroundImageVisible is not found');
414
+ return;
414
415
  }
415
- console.log("[window-manager] onMainViewScenePathChange" + scenePath + 'mainViewElement is not found');
416
+ console.log("[window-manager] onMainViewScenePathChange scenePath:" + scenePath + ' mainViewElement is not found');
416
417
  }
417
418
 
418
419
  private static initManager(room: Room): Promise<WindowManager | undefined> {
@@ -1047,7 +1048,6 @@ export class WindowManager
1047
1048
  animationMode?: AnimationMode;
1048
1049
  }>
1049
1050
  ): void {
1050
- console.log("[window-manager] moveCameraToContain" + JSON.stringify(rectangle));
1051
1051
  this.mainView.moveCameraToContain(rectangle);
1052
1052
  setTimeout(() => {
1053
1053
  this.appManager?.mainViewProxy.setCameraAndSize();