@netless/window-manager 0.4.44 → 0.4.45

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/docs/api.md CHANGED
@@ -10,6 +10,7 @@
10
10
  - [实例方法](#instance-methods)
11
11
  - [`addApp`](#addApp)
12
12
  - [`closeApp`](#closeApp)
13
+ - [`focusApp`](#focusApp)
13
14
  - [`setMainViewSceneIndex`](#setMainViewSceneIndex)
14
15
  - [`setBoxState`](#setBoxState)
15
16
  - [`cleanCurrentScene`](#cleanCurrentScene)
@@ -143,6 +144,14 @@ const appId = await manager.addApp({
143
144
  manager.closeApp(appId)
144
145
  ```
145
146
 
147
+ <h3 id="focusApp">focusApp</h3>
148
+
149
+ > 切换当前 `focus` 的 `app`, 并把此 `app` 置为最前
150
+
151
+ ```typescript
152
+ manager.focusApp(appId)
153
+ ```
154
+
146
155
  <h3 id="setMainViewSceneIndex">setMainViewSceneIndex</h3>
147
156
 
148
157
  > 设置主白板的 `SceneIndex`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netless/window-manager",
3
- "version": "0.4.44",
3
+ "version": "0.4.45",
4
4
  "description": "",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.es.js",
package/src/index.ts CHANGED
@@ -754,6 +754,18 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes, any>
754
754
  return this.appManager?.closeApp(appId);
755
755
  }
756
756
 
757
+ /**
758
+ * 切换 focus 到指定的 app, 并且把这个 app 放到最前面
759
+ */
760
+ public focusApp(appId: string) {
761
+ const box = this.boxManager?.getBox(appId);
762
+ if (box) {
763
+ this.boxManager?.focusBox({ appId }, false);
764
+ // 1.0 版本这里会有正式的 api
765
+ (this.boxManager?.teleBoxManager as any).makeBoxTop(box, false);
766
+ }
767
+ }
768
+
757
769
  public moveCamera(
758
770
  camera: Partial<Camera> & { animationMode?: AnimationMode | undefined }
759
771
  ): void {