@netless/window-manager 0.3.0-canary.0 → 0.3.0

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.
Files changed (34) hide show
  1. package/dist/AttributesDelegate.d.ts +1 -0
  2. package/dist/BoxManager.d.ts +1 -0
  3. package/dist/Cursor/index.d.ts +0 -1
  4. package/dist/index.d.ts +3 -1
  5. package/dist/index.es.js +1 -1
  6. package/dist/index.es.js.map +1 -1
  7. package/dist/index.umd.js +1 -1
  8. package/dist/index.umd.js.map +1 -1
  9. package/example/.env +4 -0
  10. package/example/babel.config.js +15 -0
  11. package/example/dist/assets/css/chunk-vendors.d2fb6693.chunk.css +1 -0
  12. package/example/dist/assets/css/index.12f29b9a.chunk.css +1 -0
  13. package/example/dist/assets/js/chunk-vendors.d2fb6693.chunk.js +2 -0
  14. package/example/dist/assets/js/chunk-vendors.d2fb6693.chunk.js.LICENSE.txt +136 -0
  15. package/example/dist/assets/js/index.12f29b9a.chunk.js +1 -0
  16. package/example/dist/assets/js/runtime~index.d502de40.js +1 -0
  17. package/example/dist/index.html +1 -0
  18. package/example/index.html +13 -0
  19. package/example/index.tsx +367 -0
  20. package/example/package.json +23 -0
  21. package/example/poi.config.js +12 -0
  22. package/example/test.js +114 -0
  23. package/package.json +2 -2
  24. package/src/AppListener.ts +0 -1
  25. package/src/AppManager.ts +18 -0
  26. package/src/AppProxy.ts +1 -1
  27. package/src/AttributesDelegate.ts +4 -0
  28. package/src/Base/Context.ts +0 -1
  29. package/src/BoxManager.ts +12 -4
  30. package/src/Cursor/Cursor.ts +1 -0
  31. package/src/Cursor/index.ts +15 -11
  32. package/src/Utils/Common.ts +4 -4
  33. package/src/index.ts +5 -4
  34. package/e2e/cypress/screenshots/reconnect.spec.ts//351/207/215/350/277/236 -- /346/226/255/347/275/221/351/207/215/350/277/236 (failed).png +0 -0
@@ -0,0 +1,367 @@
1
+ import React from "react";
2
+ import ReactDom from "react-dom";
3
+ import { PlayerPhase, WhiteWebSdk } from "white-web-sdk";
4
+ import type { AppContext} from "../dist";
5
+ import { BuiltinApps, WindowManager } from "../dist/index.es";
6
+ import "../dist/style.css";
7
+ import "video.js/dist/video-js.css";
8
+
9
+ const anyWindow = window as any;
10
+
11
+ const createHelloWorld = () => {
12
+ anyWindow.manager.addApp({
13
+ kind: "HelloWorld",
14
+ options: {
15
+ scenePath: "/helloworld1"
16
+ }
17
+ });
18
+ }
19
+
20
+ const createDocs1 = () => {
21
+ anyWindow.manager.addApp({
22
+ kind: BuiltinApps.DocsViewer,
23
+ options: {
24
+ scenePath: "/test5/",
25
+ title: "ppt1",
26
+ scenes: [
27
+ {
28
+ name: "1",
29
+ ppt: {
30
+ "height": 1010,
31
+ "src": "https://convertcdn.netless.link/staticConvert/18140800fe8a11eb8cb787b1c376634e/1.png",
32
+ "width": 714
33
+ }
34
+ },
35
+ {
36
+ name: "2",
37
+ ppt: {
38
+ "height": 1010,
39
+ "src": "https://convertcdn.netless.link/staticConvert/18140800fe8a11eb8cb787b1c376634e/2.png",
40
+ "width": 714
41
+ }
42
+ },
43
+ ]
44
+ },
45
+ }).then(appId => console.log("appID", appId));
46
+ }
47
+ const createDocs2 = () => {
48
+ anyWindow.manager.addApp({
49
+ kind: BuiltinApps.DocsViewer,
50
+ options: {
51
+ scenePath: "/ppt3",
52
+ title: "ppt3",
53
+ scenes: [
54
+ {
55
+ "name": "1",
56
+ "ppt": {
57
+ "height": 720,
58
+ "previewURL": "https://convertcdn.netless.link/dynamicConvert/6a212c90fa5311ea8b9c074232aaccd4/preview/1.png",
59
+ "src": "pptx://cover.herewhite.com/dynamicConvert/6a212c90fa5311ea8b9c074232aaccd4/1.slide",
60
+ "width": 1280
61
+ }
62
+ },
63
+ {
64
+ "name": "2",
65
+ "ppt": {
66
+ "height": 720,
67
+ "previewURL": "https://convertcdn.netless.link/dynamicConvert/6a212c90fa5311ea8b9c074232aaccd4/preview/2.png",
68
+ "src": "pptx://cover.herewhite.com/dynamicConvert/6a212c90fa5311ea8b9c074232aaccd4/2.slide",
69
+ "width": 1280
70
+ }
71
+ },
72
+ {
73
+ "name": "3",
74
+ "ppt": {
75
+ "height": 720,
76
+ "previewURL": "https://convertcdn.netless.link/dynamicConvert/6a212c90fa5311ea8b9c074232aaccd4/preview/3.png",
77
+ "src": "pptx://cover.herewhite.com/dynamicConvert/6a212c90fa5311ea8b9c074232aaccd4/3.slide",
78
+ "width": 1280
79
+ }
80
+ },
81
+ {
82
+ "name": "4",
83
+ "ppt": {
84
+ "height": 720,
85
+ "previewURL": "https://convertcdn.netless.link/dynamicConvert/6a212c90fa5311ea8b9c074232aaccd4/preview/4.png",
86
+ "src": "pptx://cover.herewhite.com/dynamicConvert/6a212c90fa5311ea8b9c074232aaccd4/4.slide",
87
+ "width": 1280
88
+ }
89
+ },
90
+ {
91
+ "name": "5",
92
+ "ppt": {
93
+ "height": 720,
94
+ "previewURL": "https://convertcdn.netless.link/dynamicConvert/6a212c90fa5311ea8b9c074232aaccd4/preview/5.png",
95
+ "src": "pptx://cover.herewhite.com/dynamicConvert/6a212c90fa5311ea8b9c074232aaccd4/5.slide",
96
+ "width": 1280
97
+ }
98
+ },
99
+ {
100
+ "name": "6",
101
+ "ppt": {
102
+ "height": 720,
103
+ "previewURL": "https://convertcdn.netless.link/dynamicConvert/6a212c90fa5311ea8b9c074232aaccd4/preview/6.png",
104
+ "src": "pptx://cover.herewhite.com/dynamicConvert/6a212c90fa5311ea8b9c074232aaccd4/6.slide",
105
+ "width": 1280
106
+ }
107
+ },
108
+ {
109
+ "name": "7",
110
+ "ppt": {
111
+ "height": 720,
112
+ "previewURL": "https://convertcdn.netless.link/dynamicConvert/6a212c90fa5311ea8b9c074232aaccd4/preview/7.png",
113
+ "src": "pptx://cover.herewhite.com/dynamicConvert/6a212c90fa5311ea8b9c074232aaccd4/7.slide",
114
+ "width": 1280
115
+ }
116
+ },
117
+ {
118
+ "name": "8",
119
+ "ppt": {
120
+ "height": 720,
121
+ "previewURL": "https://convertcdn.netless.link/dynamicConvert/6a212c90fa5311ea8b9c074232aaccd4/preview/8.png",
122
+ "src": "pptx://cover.herewhite.com/dynamicConvert/6a212c90fa5311ea8b9c074232aaccd4/8.slide",
123
+ "width": 1280
124
+ }
125
+ },
126
+ {
127
+ "name": "9",
128
+ "ppt": {
129
+ "height": 720,
130
+ "previewURL": "https://convertcdn.netless.link/dynamicConvert/6a212c90fa5311ea8b9c074232aaccd4/preview/9.png",
131
+ "src": "pptx://cover.herewhite.com/dynamicConvert/6a212c90fa5311ea8b9c074232aaccd4/9.slide",
132
+ "width": 1280
133
+ }
134
+ },
135
+ {
136
+ "name": "10",
137
+ "ppt": {
138
+ "height": 720,
139
+ "previewURL": "https://convertcdn.netless.link/dynamicConvert/6a212c90fa5311ea8b9c074232aaccd4/preview/10.png",
140
+ "src": "pptx://cover.herewhite.com/dynamicConvert/6a212c90fa5311ea8b9c074232aaccd4/10.slide",
141
+ "width": 1280
142
+ }
143
+ },
144
+ {
145
+ "name": "11",
146
+ "ppt": {
147
+ "height": 720,
148
+ "previewURL": "https://convertcdn.netless.link/dynamicConvert/6a212c90fa5311ea8b9c074232aaccd4/preview/11.png",
149
+ "src": "pptx://cover.herewhite.com/dynamicConvert/6a212c90fa5311ea8b9c074232aaccd4/11.slide",
150
+ "width": 1280
151
+ }
152
+ },
153
+ {
154
+ "name": "12",
155
+ "ppt": {
156
+ "height": 720,
157
+ "previewURL": "https://convertcdn.netless.link/dynamicConvert/6a212c90fa5311ea8b9c074232aaccd4/preview/12.png",
158
+ "src": "pptx://cover.herewhite.com/dynamicConvert/6a212c90fa5311ea8b9c074232aaccd4/12.slide",
159
+ "width": 1280
160
+ }
161
+ },
162
+ {
163
+ "name": "13",
164
+ "ppt": {
165
+ "height": 720,
166
+ "previewURL": "https://convertcdn.netless.link/dynamicConvert/6a212c90fa5311ea8b9c074232aaccd4/preview/13.png",
167
+ "src": "pptx://cover.herewhite.com/dynamicConvert/6a212c90fa5311ea8b9c074232aaccd4/13.slide",
168
+ "width": 1280
169
+ }
170
+ },
171
+ {
172
+ "name": "14",
173
+ "ppt": {
174
+ "height": 720,
175
+ "previewURL": "https://convertcdn.netless.link/dynamicConvert/6a212c90fa5311ea8b9c074232aaccd4/preview/14.png",
176
+ "src": "pptx://cover.herewhite.com/dynamicConvert/6a212c90fa5311ea8b9c074232aaccd4/14.slide",
177
+ "width": 1280
178
+ }
179
+ },
180
+ {
181
+ "name": "15",
182
+ "ppt": {
183
+ "height": 720,
184
+ "previewURL": "https://convertcdn.netless.link/dynamicConvert/6a212c90fa5311ea8b9c074232aaccd4/preview/15.png",
185
+ "src": "pptx://cover.herewhite.com/dynamicConvert/6a212c90fa5311ea8b9c074232aaccd4/15.slide",
186
+ "width": 1280
187
+ }
188
+ },
189
+ {
190
+ "name": "16",
191
+ "ppt": {
192
+ "height": 720,
193
+ "previewURL": "https://convertcdn.netless.link/dynamicConvert/6a212c90fa5311ea8b9c074232aaccd4/preview/16.png",
194
+ "src": "pptx://cover.herewhite.com/dynamicConvert/6a212c90fa5311ea8b9c074232aaccd4/16.slide",
195
+ "width": 1280
196
+ }
197
+ }
198
+ ]
199
+ }
200
+ })
201
+ }
202
+ const createVideo = () => {
203
+ anyWindow.manager.addApp({
204
+ kind: BuiltinApps.MediaPlayer,
205
+ attributes: {
206
+ src: "https://developer-assets.netless.link/Zelda.mp4"
207
+ }
208
+ })
209
+ }
210
+
211
+ let firstPlay = false;
212
+
213
+ const replay = () => {
214
+ sdk.replayRoom({
215
+ room: process.env.ROOM_UUID,
216
+ roomToken: process.env.ROOM_TOKEN,
217
+ invisiblePlugins: [WindowManager as any],
218
+ useMultiViews: true,
219
+ }).then(async player => {
220
+ await anyWindow.manager.destroy();
221
+ anyWindow.room.disconnect();
222
+ setTimeout(async () => {
223
+ anyWindow.player = player;
224
+ // player.bindHtmlElement(document.getElementById("container") as any)
225
+ player.play()
226
+ }, 500)
227
+ player.callbacks.on("onPhaseChanged", phase => {
228
+ if (phase === PlayerPhase.Playing) {
229
+ if (firstPlay) return;
230
+ setTimeout(() => {
231
+ mountManager(player, document.getElementById("container"))
232
+ }, 1000)
233
+ firstPlay = true
234
+ }
235
+ })
236
+ })
237
+ }
238
+
239
+ const onRef = (ref) => {
240
+ sdk.joinRoom({
241
+ uuid: process.env.ROOM_UUID,
242
+ roomToken: process.env.ROOM_TOKEN,
243
+ invisiblePlugins: [WindowManager as any],
244
+ useMultiViews: true,
245
+ userPayload: {
246
+ userId: "111",
247
+ cursorName: "测试测试",
248
+ avatar: "https://avatars.githubusercontent.com/u/8299540?s=60&v=4",
249
+ },
250
+ isWritable: !(isWritable === "false"),
251
+ cursorAdapter: undefined,
252
+ uid: Math.random().toString().substr(3, 8),
253
+ disableMagixEventDispatchLimit: true,
254
+ }).then(async room => {
255
+ if (room.isWritable) {
256
+ room.setMemberState({ strokeColor: [0, 0, 1] });
257
+ }
258
+
259
+ (window as any).room = room;
260
+ await mountManager(room, ref);
261
+ })
262
+ }
263
+
264
+ const HelloWorldApp = async () => {
265
+ console.log('start loading HelloWorld...')
266
+ // await new Promise(resolve => setTimeout(resolve, 2000))
267
+ console.log('HelloWorld Loaded')
268
+ return {
269
+ kind: "HelloWorld",
270
+ setup: (context: AppContext<any, any>) => {
271
+ console.log('helloworld options', context.getAppOptions());
272
+ context.mountView(context.getBox().$content as any);
273
+ context.emitter.on("destroy",() => console.log("[HelloWorld]: destroy"))
274
+ return "Hello World Result";
275
+ }
276
+ }
277
+ };
278
+
279
+ WindowManager.register({
280
+ kind: "HelloWorld",
281
+ src: HelloWorldApp,
282
+ appOptions: () => 'AppOptions',
283
+ addHooks: (emitter) => {
284
+ emitter.on('created', result => {
285
+ console.log('HelloWordResult', result);
286
+ })
287
+ }
288
+ });
289
+
290
+ const sdk = new WhiteWebSdk({
291
+ appIdentifier: process.env.APPID,
292
+ useMobXState: true
293
+ });
294
+
295
+ (window as any).WindowManager = WindowManager;
296
+ const search = window.location.search;
297
+ const url = new URLSearchParams(search);
298
+ const isWritable = url.get("isWritable");
299
+
300
+ const mountManager = async (room, root) => {
301
+ const manager = await WindowManager.mount({
302
+ room,
303
+ container: root,
304
+ // collectorStyles: { bottom: "100px", right: "30px" },
305
+ containerSizeRatio: 9 / 16,
306
+ chessboard: true,
307
+ debug: true,
308
+ cursor: true,
309
+ // disableCameraTransform: true,
310
+ });
311
+
312
+ (window as any).manager = manager;
313
+ (window as any).manager.onAppDestroy(BuiltinApps.DocsViewer, (error) => {
314
+ console.log("onAppDestroy", error)
315
+ });
316
+
317
+ (window as any).manager.emitter.on("mainViewModeChange", mode => {
318
+ console.log("mode", mode);
319
+ })
320
+
321
+ manager.emitter.on("boxStateChange", state => {
322
+ console.log("boxState", state);
323
+ });
324
+ console.log("boxState", manager.boxState);
325
+ }
326
+ const destroy = () => {
327
+ anyWindow.manager.destroy();
328
+ anyWindow.manager = undefined;
329
+ }
330
+
331
+ anyWindow.mountManager = mountManager;
332
+ anyWindow.destroy = destroy;
333
+
334
+ const App = () => {
335
+ return (
336
+ <div style={{
337
+ display: "flex",
338
+ width: "100vw",
339
+ height: "100vh",
340
+ padding: "16px 16px",
341
+ overflow: "hidden",
342
+ boxSizing: "border-box"
343
+ }}>
344
+ <div ref={onRef} id="container" style={{
345
+ flex: 1,
346
+ height: "calc(100vh - 32px)",
347
+ border: "1px solid"
348
+ }}>
349
+ </div>
350
+ <div style={{
351
+ flexShrink: 0,
352
+ padding: "16px",
353
+ marginRight: "16px",
354
+ textAlign: "center",
355
+ userSelect: "none"
356
+ }}>
357
+ <button style={{ display: "block", margin: "1em 0" }} onClick={createHelloWorld}>Hello World</button>
358
+ <button style={{ display: "block", margin: "1em 0" }} onClick={createDocs1}>课件1</button>
359
+ <button style={{ display: "block", margin: "1em 0" }} onClick={createDocs2}>课件2</button>
360
+ <button style={{ display: "block", margin: "1em 0" }} onClick={createVideo}>视频</button>
361
+ <button style={{ display: "block", margin: "1em 0" }} onClick={replay}>回放</button>
362
+ </div>
363
+ </div>
364
+ )
365
+ }
366
+
367
+ ReactDom.render(<App />, document.getElementById("root"))
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "test",
3
+ "version": "1.0.0",
4
+ "description": "",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "dev": "poi index.html --serve --watch"
8
+ },
9
+ "keywords": [],
10
+ "author": "",
11
+ "license": "ISC",
12
+ "dependencies": {
13
+ "@netless/video-js-plugin": "^0.3.7",
14
+ "normalize.css": "^8.0.1",
15
+ "p-queue": "^7.1.0",
16
+ "react": "^17.0.2",
17
+ "react-dom": "^17.0.2",
18
+ "video.js": "^7.14.3"
19
+ },
20
+ "devDependencies": {
21
+ "poi": "^12.10.3"
22
+ }
23
+ }
@@ -0,0 +1,12 @@
1
+ // eslint-disable-next-line
2
+ const dotenv = require('dotenv').config();
3
+
4
+ // eslint-disable-next-line no-undef
5
+ module.exports = {
6
+ envs: dotenv.parsed,
7
+ configureWebpack: {
8
+ module: {
9
+ unknownContextCritical: false
10
+ }
11
+ },
12
+ }
@@ -0,0 +1,114 @@
1
+ export const scenes = [
2
+ {
3
+ "name": "2d9a8a51-08c1-4949-94f9-7d186d04b3b0",
4
+ "ppt": {
5
+ "width": 612,
6
+ "height": 870,
7
+ "src": "https://convertcdn.netless.link/staticConvert/245bab80eeb911ebb78953592d694b06/1.png"
8
+ }
9
+ },
10
+ {
11
+ "name": "50bfa0be-c17b-4b36-87d8-39d406f2ff98",
12
+ "ppt": {
13
+ "width": 612,
14
+ "height": 870,
15
+ "src": "https://convertcdn.netless.link/staticConvert/245bab80eeb911ebb78953592d694b06/2.png"
16
+ }
17
+ },
18
+ {
19
+ "name": "4fcc3ac8-d730-43c0-ab8e-7cb633a9a333",
20
+ "ppt": {
21
+ "width": 612,
22
+ "height": 870,
23
+ "src": "https://convertcdn.netless.link/staticConvert/245bab80eeb911ebb78953592d694b06/3.png"
24
+ }
25
+ },
26
+ {
27
+ "name": "078be34b-9f0e-42b5-b972-8b0dd1f3bc8d",
28
+ "ppt": {
29
+ "width": 612,
30
+ "height": 870,
31
+ "src": "https://convertcdn.netless.link/staticConvert/245bab80eeb911ebb78953592d694b06/4.png"
32
+ }
33
+ },
34
+ {
35
+ "name": "753d4588-0a6b-413b-b6c1-2f6ead5040db",
36
+ "ppt": {
37
+ "width": 612,
38
+ "height": 870,
39
+ "src": "https://convertcdn.netless.link/staticConvert/245bab80eeb911ebb78953592d694b06/5.png"
40
+ }
41
+ },
42
+ {
43
+ "name": "855aeadf-2087-4c02-94a9-301e9c032a8f",
44
+ "ppt": {
45
+ "width": 612,
46
+ "height": 870,
47
+ "src": "https://convertcdn.netless.link/staticConvert/245bab80eeb911ebb78953592d694b06/6.png"
48
+ }
49
+ },
50
+ {
51
+ "name": "31c45862-a931-4733-86c1-3087a9f0f8d5",
52
+ "ppt": {
53
+ "width": 612,
54
+ "height": 870,
55
+ "src": "https://convertcdn.netless.link/staticConvert/245bab80eeb911ebb78953592d694b06/7.png"
56
+ }
57
+ },
58
+ {
59
+ "name": "bf4a0ca3-e4b4-402e-a150-6f6b2ae5b213",
60
+ "ppt": {
61
+ "width": 612,
62
+ "height": 870,
63
+ "src": "https://convertcdn.netless.link/staticConvert/245bab80eeb911ebb78953592d694b06/8.png"
64
+ }
65
+ },
66
+ {
67
+ "name": "fdad1852-b143-4f7c-926a-64902cdfc049",
68
+ "ppt": {
69
+ "width": 612,
70
+ "height": 870,
71
+ "src": "https://convertcdn.netless.link/staticConvert/245bab80eeb911ebb78953592d694b06/9.png"
72
+ }
73
+ },
74
+ {
75
+ "name": "1290c291-3b10-442f-b03d-8bbd5754b9b5",
76
+ "ppt": {
77
+ "width": 612,
78
+ "height": 870,
79
+ "src": "https://convertcdn.netless.link/staticConvert/245bab80eeb911ebb78953592d694b06/10.png"
80
+ }
81
+ },
82
+ {
83
+ "name": "a68cf556-4789-423e-bb93-d86429229043",
84
+ "ppt": {
85
+ "width": 612,
86
+ "height": 870,
87
+ "src": "https://convertcdn.netless.link/staticConvert/245bab80eeb911ebb78953592d694b06/11.png"
88
+ }
89
+ },
90
+ {
91
+ "name": "2bda29d6-484a-4ac5-ab53-52006b23ee6c",
92
+ "ppt": {
93
+ "width": 612,
94
+ "height": 870,
95
+ "src": "https://convertcdn.netless.link/staticConvert/245bab80eeb911ebb78953592d694b06/12.png"
96
+ }
97
+ },
98
+ {
99
+ "name": "90dd0526-dff9-494d-a2d6-417b64eb605b",
100
+ "ppt": {
101
+ "width": 612,
102
+ "height": 870,
103
+ "src": "https://convertcdn.netless.link/staticConvert/245bab80eeb911ebb78953592d694b06/13.png"
104
+ }
105
+ },
106
+ {
107
+ "name": "9fcb4e45-f160-42e6-88c8-1da7ff291b7d",
108
+ "ppt": {
109
+ "width": 612,
110
+ "height": 870,
111
+ "src": "https://convertcdn.netless.link/staticConvert/245bab80eeb911ebb78953592d694b06/14.png"
112
+ }
113
+ }
114
+ ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netless/window-manager",
3
- "version": "0.3.0-canary.0",
3
+ "version": "0.3.0",
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.2",
27
+ "@netless/telebox-insider": "0.2.3",
28
28
  "emittery": "^0.9.2",
29
29
  "lodash": "^4.17.21",
30
30
  "p-retry": "^4.6.1",
@@ -1,7 +1,6 @@
1
1
  import { Events, MagixEventName } from "./constants";
2
2
  import { ViewVisionMode } from "white-web-sdk";
3
3
  import type { Event } from "white-web-sdk";
4
- import type { TeleBox } from "@netless/telebox-insider";
5
4
  import type { AppManager } from "./AppManager";
6
5
 
7
6
  export class AppListeners {
package/src/AppManager.ts CHANGED
@@ -12,6 +12,7 @@ import { callbacks, emitter } from './index';
12
12
  import { CameraStore } from './Utils/CameraStore';
13
13
  import { genAppId, makeValidScenePath, setScenePath } from './Utils/Common';
14
14
  import {
15
+ autorun,
15
16
  isPlayer,
16
17
  isRoom,
17
18
  ScenePathType,
@@ -76,6 +77,22 @@ export class AppManager {
76
77
  this.onAppDelete(this.attributes.apps);
77
78
  });
78
79
  });
80
+ this.refresher?.add("maximized", () => {
81
+ return autorun(
82
+ () => {
83
+ const maximized = this.attributes.maximized
84
+ this.boxManager.teleBoxManager.setMaximized(Boolean(maximized), true);
85
+ }
86
+ )
87
+ });
88
+ this.refresher?.add("minimized", () => {
89
+ return autorun(
90
+ () => {
91
+ const minimized = this.attributes.minimized
92
+ this.boxManager.teleBoxManager.setMinimized(Boolean(minimized), true);
93
+ }
94
+ )
95
+ });
79
96
  if (!this.attributes.apps || Object.keys(this.attributes.apps).length === 0) {
80
97
  const mainScenePath = this.store.getMainViewScenePath();
81
98
  if (!mainScenePath) return;
@@ -442,6 +459,7 @@ export class AppManager {
442
459
  });
443
460
  }
444
461
  this.viewManager.destroy();
462
+ this.boxManager.destroy();
445
463
  this.refresher?.destroy();
446
464
  this.mainViewProxy.destroy();
447
465
  callbacks.clearListeners();
package/src/AppProxy.ts CHANGED
@@ -5,7 +5,7 @@ import { appRegister } from "./Register";
5
5
  import { autorun, ViewVisionMode } from "white-web-sdk";
6
6
  import { callbacks, emitter } from "./index";
7
7
  import { Fields } from "./AttributesDelegate";
8
- import { get, isEmpty } from "lodash";
8
+ import { get } from "lodash";
9
9
  import { log } from "./Utils/log";
10
10
  import {
11
11
  notifyMainViewModeChange,
@@ -52,6 +52,10 @@ export class AttributesDelegate {
52
52
  return get(this.apps(), [id, Fields.State]);
53
53
  }
54
54
 
55
+ public getMaximized() {
56
+ return get(this.manager.attributes, ["maximized"])
57
+ }
58
+
55
59
  public setupAppAttributes(params: AddAppParams, id: string, isDynamicPPT: boolean) {
56
60
  const attributes = this.manager.attributes;
57
61
  if (!attributes.apps) {
@@ -1,7 +1,6 @@
1
1
  import { memoize } from "lodash";
2
2
  import { emitter } from "../index";
3
3
  import type { AppManager } from "../AppManager";
4
- import type { MoveCursorParams } from "../Cursor";
5
4
 
6
5
  export class Context {
7
6
  public observerId: number;
package/src/BoxManager.ts CHANGED
@@ -216,12 +216,16 @@ export class BoxManager {
216
216
  if (state.maximized != null) {
217
217
  this.teleBoxManager.setMaximized(Boolean(state.maximized), true);
218
218
  this.teleBoxManager.setMinimized(Boolean(state.minimized), true);
219
- } else if (state.boxState) {
219
+ }
220
+ if (state.boxState) {
220
221
  this.teleBoxManager.setState(state.boxState, true);
221
222
  }
222
- if (state.focus) {
223
- this.teleBoxManager.update(box.id, { focus: true }, true);
224
- }
223
+ setTimeout(() => {
224
+ if (state.focus) {
225
+ this.teleBoxManager.update(box.id, { focus: true }, true);
226
+ }
227
+ }, 50);
228
+ callbacks.emit("boxStateChange", this.teleBoxManager.state);
225
229
  }
226
230
  }
227
231
 
@@ -281,4 +285,8 @@ export class BoxManager {
281
285
  this.teleBoxManager.setState(state, true);
282
286
  callbacks.emit("boxStateChange", state);
283
287
  }
288
+
289
+ public destroy() {
290
+ this.teleBoxManager.destroy();
291
+ }
284
292
  }
@@ -142,6 +142,7 @@ export class Cursor extends Base {
142
142
  }
143
143
  this.timer = window.setTimeout(() => {
144
144
  this.hide();
145
+ this.store.updateCursorState(this.context.uid, CursorState.Leave);
145
146
  }, 1000 * 10); // 10 秒钟自动隐藏
146
147
  }
147
148