@netless/window-manager 0.3.0 → 0.3.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,6 +1,6 @@
1
1
  {
2
2
  "name": "@netless/window-manager",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "",
5
5
  "main": "dist/index.es.js",
6
6
  "module": "dist/index.es.js",
@@ -24,7 +24,7 @@
24
24
  "@juggle/resize-observer": "^3.3.1",
25
25
  "@netless/app-docs-viewer": "^0.1.21",
26
26
  "@netless/app-media-player": "0.1.0-beta.5",
27
- "@netless/telebox-insider": "0.2.3",
27
+ "@netless/telebox-insider": "0.2.4",
28
28
  "emittery": "^0.9.2",
29
29
  "lodash": "^4.17.21",
30
30
  "p-retry": "^4.6.1",
@@ -30,10 +30,6 @@ export class AppListeners {
30
30
  this.appResizeHandler(data.payload);
31
31
  break;
32
32
  }
33
- case Events.AppBlur: {
34
- this.appBlurHandler(data.payload);
35
- break;
36
- }
37
33
  case Events.AppBoxStateChange: {
38
34
  this.appBoxStateHandler(data.payload);
39
35
  break;
@@ -57,21 +53,10 @@ export class AppListeners {
57
53
  this.manager.room?.refreshViewSize();
58
54
  };
59
55
 
60
- private appBlurHandler = (payload: any) => {
61
- const proxy = this.appProxies.get(payload.appId);
62
- if (proxy) {
63
- proxy.appEmitter.emit("writableChange", false);
64
- if (proxy.view?.mode === ViewVisionMode.Writable) {
65
- this.manager.viewManager.refreshViews();
66
- }
67
- }
68
- };
69
-
70
56
  private appBoxStateHandler = (payload: any) => {
71
57
  this.boxManager.setBoxState(payload.state);
72
58
  };
73
59
 
74
-
75
60
  private switchViewsToFreedomHandler = () => {
76
61
  this.manager.viewManager.freedomAllViews();
77
62
  };
package/src/AppManager.ts CHANGED
@@ -80,16 +80,20 @@ export class AppManager {
80
80
  this.refresher?.add("maximized", () => {
81
81
  return autorun(
82
82
  () => {
83
- const maximized = this.attributes.maximized
84
- this.boxManager.teleBoxManager.setMaximized(Boolean(maximized), true);
83
+ const maximized = this.attributes.maximized;
84
+ if (this.boxManager.teleBoxManager.maximized !== maximized) {
85
+ this.boxManager.teleBoxManager.setMaximized(Boolean(maximized), true);
86
+ }
85
87
  }
86
88
  )
87
89
  });
88
90
  this.refresher?.add("minimized", () => {
89
91
  return autorun(
90
92
  () => {
91
- const minimized = this.attributes.minimized
92
- this.boxManager.teleBoxManager.setMinimized(Boolean(minimized), true);
93
+ const minimized = this.attributes.minimized;
94
+ if (this.boxManager.teleBoxManager.minimized !== minimized) {
95
+ this.boxManager.teleBoxManager.setMinimized(Boolean(minimized), true);
96
+ }
93
97
  }
94
98
  )
95
99
  });
@@ -98,7 +102,7 @@ export class AppManager {
98
102
  if (!mainScenePath) return;
99
103
  const sceneState = this.displayer.state.sceneState;
100
104
  if (sceneState.scenePath !== mainScenePath) {
101
- this.room?.setScenePath(mainScenePath);
105
+ setScenePath(this.room, mainScenePath);
102
106
  }
103
107
  }
104
108
  this.displayerWritableListener(!this.room?.isWritable);
@@ -26,7 +26,7 @@ export const setScenePath = (room: Room | undefined, scenePath: string) => {
26
26
  room.setScenePath(scenePath);
27
27
  }
28
28
  }
29
- };
29
+ }
30
30
 
31
31
  export const setViewMode = (view: View, mode: ViewVisionMode) => {
32
32
  if (view.mode !== mode) {
package/src/index.ts CHANGED
@@ -170,7 +170,7 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> {
170
170
  public static containerSizeRatio = DEFAULT_CONTAINER_RATIO;
171
171
  private static isCreated = false;
172
172
 
173
- public version = "0.3.0";
173
+ public version = "0.3.1";
174
174
 
175
175
  public appListeners?: AppListeners;
176
176
 
@@ -136,10 +136,7 @@ export class ViewManager extends Base {
136
136
  setTimeout(() => {
137
137
  const appProxy = this.manager.appProxies.get(id);
138
138
  if (appProxy) {
139
- const boxState = this.store.getBoxState();
140
- if (boxState && boxState === TELE_BOX_STATE.Minimized) {
141
- return;
142
- }
139
+ if (this.manager.boxManager.teleBoxManager.minimized) return;
143
140
  appProxy.setScenePath();
144
141
  appProxy.switchToWritable();
145
142
  appProxy.focusBox();