@netless/window-manager 0.4.66 → 0.4.67-beta.1

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,17 +1,17 @@
1
1
  {
2
2
  "name": "@netless/window-manager",
3
- "version": "0.4.66",
4
- "description": "",
3
+ "version": "0.4.67-beta.1",
4
+ "description": "Multi-window mode for Netless Whiteboard",
5
+ "author": "l1shen <lishen1635@gmail.com> (https://github.com/l1shen)",
6
+ "license": "MIT",
7
+ "repository": "netless-io/window-manager",
5
8
  "main": "dist/index.js",
6
9
  "module": "dist/index.mjs",
7
10
  "types": "dist/index.d.ts",
8
- "repository": "netless-io/window-manager",
9
- "author": "l1shen <lishen1635@gmail.com> (https://github.com/l1shen)",
10
- "license": "MIT",
11
11
  "files": [
12
- "src",
13
12
  "dist",
14
- "docs"
13
+ "docs",
14
+ "src"
15
15
  ],
16
16
  "peerDependencies": {
17
17
  "jspdf": "2.5.1",
@@ -66,12 +66,12 @@
66
66
  "white-web-sdk": "2.16.43"
67
67
  },
68
68
  "scripts": {
69
- "prettier": "prettier --write .",
70
69
  "build": "vite build && yarn type-gen",
71
- "type-gen": "tsc --emitDeclarationOnly",
72
- "predev": "yarn type-gen",
73
70
  "build:lib:types": "tsc --emitDeclarationOnly",
74
71
  "lint": "eslint --ext .ts,.tsx,.svelte . && prettier --check .",
75
- "test": "vitest"
72
+ "predev": "yarn type-gen",
73
+ "prettier": "prettier --write .",
74
+ "test": "vitest",
75
+ "type-gen": "tsc --emitDeclarationOnly"
76
76
  }
77
77
  }
@@ -163,10 +163,12 @@ export class AttributesDelegate {
163
163
  }
164
164
 
165
165
  public setMainViewSize(size: ISize) {
166
+ if (size.width === 0 || size.height === 0) return;
166
167
  this.context.safeSetAttributes({ [Fields.MainViewSize]: { ...size } });
167
168
  }
168
169
 
169
170
  public setMainViewCameraAndSize(camera: ICamera, size: ISize) {
171
+ if (size.width === 0 || size.height === 0) return;
170
172
  this.context.safeSetAttributes({
171
173
  [Fields.MainViewCamera]: { ...camera },
172
174
  [Fields.MainViewSize]: { ...size },
@@ -120,6 +120,7 @@ export class MainViewProxy {
120
120
  this.moveCameraToContian(size);
121
121
  this.moveCamera(this.mainViewCamera);
122
122
  }
123
+ this.ensureMainViewSize();
123
124
  }, 30);
124
125
 
125
126
  public onUpdateContainerSizeRatio = () => {
@@ -209,7 +210,7 @@ export class MainViewProxy {
209
210
  this.manager.boxManager?.blurAllBox();
210
211
  }
211
212
 
212
- public setMainViewSize = debounce(size => {
213
+ public setMainViewSize = debounce((size: Size) => {
213
214
  this.store.setMainViewSize({ ...size, id: this.manager.uid });
214
215
  }, 50);
215
216
 
@@ -234,8 +235,16 @@ export class MainViewProxy {
234
235
  clearTimeout(this._syncMainViewTimer);
235
236
  this._syncMainViewTimer = setTimeout(this.syncMainView, 100, this.manager.room);
236
237
  }
238
+ this.ensureMainViewSize();
237
239
  };
238
240
 
241
+ private ensureMainViewSize() {
242
+ if ((!this.mainViewSize || this.mainViewSize.width === 0 || this.mainViewSize.height === 0) &&
243
+ this.mainView.size.width > 0 && this.mainView.size.height > 0) {
244
+ this.setMainViewSize(this.mainView.size);
245
+ }
246
+ }
247
+
239
248
  private syncMainView = (room: Room) => {
240
249
  if (room.isWritable) {
241
250
  room.syncMainView(this.mainView);