@netless/window-manager 1.0.13-test.13 → 1.0.13-test.14

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.13",
3
+ "version": "1.0.13-test.14",
4
4
  "description": "Multi-window mode for Netless Whiteboard",
5
5
  "author": "l1shen <lishen1635@gmail.com> (https://github.com/l1shen)",
6
6
  "license": "MIT",
@@ -29,12 +29,12 @@ export class ContainerResizeObserver {
29
29
  wrapper: HTMLDivElement
30
30
  ) {
31
31
  console.log(`[window-manager] observePlaygroundSize ${JSON.stringify(container.getBoundingClientRect())}, ${JSON.stringify(sizer.getBoundingClientRect())}, ${JSON.stringify(wrapper.getBoundingClientRect())}`);
32
- this.updateSizer(container.getBoundingClientRect(), sizer, wrapper);
32
+ this.updateSizer(container.getBoundingClientRect(), sizer, wrapper, 'observePlaygroundSize');
33
33
 
34
34
  this.containerResizeObserver = new ResizeObserver(entries => {
35
35
  const containerRect = entries[0]?.contentRect;
36
36
  if (containerRect) {
37
- this.updateSizer(containerRect, sizer, wrapper);
37
+ this.updateSizer(containerRect, sizer, wrapper, 'containerResizeObserver');
38
38
  console.log(`[window-manager] containerResizeObserver ${JSON.stringify(containerRect)}`);
39
39
  this.emitter.emit("playgroundSizeChange", containerRect);
40
40
  }
@@ -43,7 +43,7 @@ export class ContainerResizeObserver {
43
43
  this.disposer = this.emitter.on("containerSizeRatioUpdate", () => {
44
44
  const containerRect = container.getBoundingClientRect();
45
45
  console.log(`[window-manager] containerSizeRatioUpdate ${JSON.stringify(containerRect)}`);
46
- this.updateSizer(containerRect, sizer, wrapper);
46
+ this.updateSizer(containerRect, sizer, wrapper, 'containerSizeRatioUpdate');
47
47
  this.emitter.emit("playgroundSizeChange", containerRect);
48
48
  });
49
49
 
@@ -53,7 +53,8 @@ export class ContainerResizeObserver {
53
53
  public updateSizer(
54
54
  { width, height }: DOMRectReadOnly,
55
55
  sizer: HTMLElement,
56
- wrapper: HTMLDivElement
56
+ wrapper: HTMLDivElement,
57
+ origin?: string
57
58
  ) {
58
59
  if (width && height) {
59
60
  if (height / width > WindowManager.containerSizeRatio) {
@@ -66,7 +67,7 @@ export class ContainerResizeObserver {
66
67
  wrapper.style.width = `${width}px`;
67
68
  wrapper.style.height = `${height}px`;
68
69
  wrapper.style.backgroundColor = 'green';
69
- console.log(`[window-manager] updateSizer ${JSON.stringify({ width, height })} ${wrapper.style.width} ${wrapper.style.height} ${JSON.stringify(wrapper.getBoundingClientRect())}`);
70
+ console.log(`[window-manager] updateSizer from ${origin}: ${JSON.stringify({ width, height })} ${wrapper.style.width} ${wrapper.style.height} ${JSON.stringify(wrapper.getBoundingClientRect())}`);
70
71
  }
71
72
  }
72
73