@netless/window-manager 1.0.0-canary.7 → 1.0.0-canary.8
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/dist/App/AppContext.d.ts +2 -1
- package/dist/App/AppProxy.d.ts +1 -1
- package/dist/App/WhiteboardView.d.ts +4 -3
- package/dist/index.cjs.js +9 -9
- package/dist/index.es.js +13 -13
- package/dist/index.umd.js +9 -9
- package/package.json +1 -1
- package/src/App/AppContext.ts +11 -11
- package/src/App/AppProxy.ts +1 -1
- package/src/App/WhiteboardView.ts +4 -6
package/package.json
CHANGED
package/src/App/AppContext.ts
CHANGED
@@ -29,7 +29,6 @@ import type {
|
|
29
29
|
import { WhiteBoardView } from "./WhiteboardView";
|
30
30
|
import { findMemberByUid } from "../Helper";
|
31
31
|
import { MAX_PAGE_SIZE } from "../constants";
|
32
|
-
import { putScenes } from "../Utils/Common";
|
33
32
|
import { isNumber } from "lodash";
|
34
33
|
|
35
34
|
export class AppContext<TAttributes = any, TMagixEventPayloads = any, TAppOptions = any> {
|
@@ -63,9 +62,13 @@ export class AppContext<TAttributes = any, TMagixEventPayloads = any, TAppOption
|
|
63
62
|
this.isAddApp = appProxy.isAddApp;
|
64
63
|
}
|
65
64
|
|
66
|
-
public get displayer(){
|
65
|
+
public get displayer() {
|
67
66
|
return this.manager.displayer;
|
68
|
-
}
|
67
|
+
}
|
68
|
+
|
69
|
+
public get destroyed() {
|
70
|
+
return this.appProxy.status === "destroyed";
|
71
|
+
}
|
69
72
|
|
70
73
|
/** @deprecated Use context.storage.state instead. */
|
71
74
|
public getAttributes = (): TAttributes | undefined => {
|
@@ -103,13 +106,13 @@ export class AppContext<TAttributes = any, TMagixEventPayloads = any, TAppOption
|
|
103
106
|
}
|
104
107
|
view.divElement = viewWrapper;
|
105
108
|
if (this.isAddApp) {
|
106
|
-
this.
|
109
|
+
this.ensurePageSize(size);
|
107
110
|
}
|
108
|
-
this.whiteBoardView = new WhiteBoardView(this, this.appProxy, removeViewWrapper);
|
111
|
+
this.whiteBoardView = new WhiteBoardView(view, this, this.appProxy, removeViewWrapper, this.ensurePageSize);
|
109
112
|
return this.whiteBoardView;
|
110
113
|
}
|
111
114
|
|
112
|
-
private
|
115
|
+
private ensurePageSize = (size?: number) => {
|
113
116
|
if (!isNumber(size)) return;
|
114
117
|
if (!this.appProxy.scenePath) return;
|
115
118
|
if (this.appProxy.pageState.length >= size) return;
|
@@ -117,11 +120,8 @@ export class AppContext<TAttributes = any, TMagixEventPayloads = any, TAppOption
|
|
117
120
|
throw Error(`[WindowManager]: size ${size} muse be in range [1, ${MAX_PAGE_SIZE}]`);
|
118
121
|
}
|
119
122
|
const needInsert = size - this.appProxy.pageState.length;
|
120
|
-
const
|
121
|
-
|
122
|
-
return { name: `${startPageNumber + index + 1}` };
|
123
|
-
});
|
124
|
-
putScenes(this.room, this.appProxy.scenePath, scenes);
|
123
|
+
const scenes = new Array(needInsert).fill({});
|
124
|
+
this.room?.putScenes(this.appProxy.scenePath, scenes);
|
125
125
|
}
|
126
126
|
|
127
127
|
public getInitScenePath = () => {
|
package/src/App/AppProxy.ts
CHANGED
@@ -54,7 +54,7 @@ export class AppProxy implements PageRemoveService {
|
|
54
54
|
public uid = this.manager.uid;
|
55
55
|
|
56
56
|
public isAddApp: boolean;
|
57
|
-
|
57
|
+
public status: "normal" | "destroyed" = "normal";
|
58
58
|
private stateKey: string;
|
59
59
|
public _pageState: AppPageStateImpl;
|
60
60
|
private _prevFullPath: string | undefined;
|
@@ -5,15 +5,17 @@ import type { ReadonlyVal } from "value-enhancer";
|
|
5
5
|
import type { AddPageParams, PageController, PageState } from "../Page";
|
6
6
|
import type { AppProxy } from "./AppProxy";
|
7
7
|
import type { AppContext } from "./AppContext";
|
8
|
-
import type { Camera } from "white-web-sdk";
|
8
|
+
import type { Camera, View } from "white-web-sdk";
|
9
9
|
|
10
10
|
export class WhiteBoardView implements PageController {
|
11
11
|
public readonly pageState$: ReadonlyVal<PageState>;
|
12
12
|
|
13
13
|
constructor(
|
14
|
+
public view: View,
|
14
15
|
protected appContext: AppContext,
|
15
16
|
protected appProxy: AppProxy,
|
16
|
-
private removeViewWrapper: () => void
|
17
|
+
private removeViewWrapper: () => void,
|
18
|
+
public ensureSize: (size: number) => void
|
17
19
|
) {
|
18
20
|
const pageState$ = new Val<PageState>(appProxy.pageState);
|
19
21
|
this.pageState$ = pageState$;
|
@@ -22,10 +24,6 @@ export class WhiteBoardView implements PageController {
|
|
22
24
|
});
|
23
25
|
}
|
24
26
|
|
25
|
-
public get view() {
|
26
|
-
return this.appContext.view;
|
27
|
-
}
|
28
|
-
|
29
27
|
public get pageState() {
|
30
28
|
return this.pageState$.value;
|
31
29
|
}
|