@netless/window-manager 0.4.36 → 0.4.37

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": "0.4.36",
3
+ "version": "0.4.37",
4
4
  "description": "",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.es.js",
package/src/BoxManager.ts CHANGED
@@ -108,6 +108,18 @@ export class BoxManager {
108
108
  callbacks.emit("prefersColorSchemeChange", colorScheme);
109
109
  });
110
110
 
111
+ // ppt 在最小化后刷新恢复正常大小,拿不到正确的宽高,需要手动触发一下窗口的 resize
112
+ this.teleBoxManager._minimized$.reaction(minimized => {
113
+ if (!minimized) {
114
+ setTimeout(() => {
115
+ const offset = 0.001 * (Math.random() > 0.5 ? 1 : -1);
116
+ this.teleBoxManager.boxes.forEach(box => {
117
+ box.resize(box.intrinsicWidth + offset, box.intrinsicHeight + offset, true);
118
+ });
119
+ }, 400);
120
+ }
121
+ });
122
+
111
123
  // events.on 的值则会根据 skipUpdate 来决定是否触发回调
112
124
  this.teleBoxManager.events.on("minimized", minimized => {
113
125
  this.context.safeSetAttributes({ minimized });
@@ -120,14 +132,6 @@ export class BoxManager {
120
132
  this.context.setAppFocus(topBox.id);
121
133
  this.focusBox({ appId: topBox.id }, false);
122
134
  }
123
- // ppt 在最小化后刷新恢复正常大小,拿不到正确的宽高,需要手动触发一下窗口的 resize
124
- setTimeout(() => {
125
- this.teleBoxManager.boxes.forEach(box => {
126
- const width = box.width;
127
- const height = box.height;
128
- box._size$.setValue({ width: width + 0.001, height: height + 0.001 }, true);
129
- });
130
- }, 100);
131
135
  }
132
136
  });
133
137
  this.teleBoxManager.events.on("maximized", maximized => {