@netless/window-manager 1.0.0-canary.6 → 1.0.0-canary.9
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 +8 -3
- package/dist/App/WhiteboardView.d.ts +4 -3
- package/dist/AppManager.d.ts +2 -2
- package/dist/BoxManager.d.ts +1 -2
- package/dist/Page/PageController.d.ts +1 -0
- package/dist/View/CameraSynchronizer.d.ts +3 -4
- package/dist/View/MainView.d.ts +0 -1
- package/dist/index.cjs.js +10 -10
- package/dist/index.d.ts +3 -2
- package/dist/index.es.js +147 -161
- package/dist/index.umd.js +10 -10
- package/package.json +2 -2
- package/pnpm-lock.yaml +4 -4
- package/src/App/AppContext.ts +13 -12
- package/src/App/AppProxy.ts +94 -72
- package/src/App/AppViewSync.ts +2 -2
- package/src/App/WhiteboardView.ts +4 -6
- package/src/AppManager.ts +16 -18
- package/src/BoxManager.ts +2 -6
- package/src/Page/PageController.ts +1 -0
- package/src/View/CameraSynchronizer.ts +3 -20
- package/src/View/MainView.ts +15 -28
- package/src/index.ts +15 -2
- package/dist/View/ViewSync.d.ts +0 -7
- package/src/View/ViewSync.ts +0 -10
package/src/View/MainView.ts
CHANGED
@@ -32,34 +32,29 @@ export class MainViewProxy {
|
|
32
32
|
this.ensureCameraAndSize();
|
33
33
|
this.startListenWritableChange();
|
34
34
|
});
|
35
|
-
this.sideEffectManager.add(() =>
|
36
|
-
|
37
|
-
|
38
|
-
this.sideEffectManager.add(() => {
|
39
|
-
return emitter.on("startReconnect", () => {
|
35
|
+
this.sideEffectManager.add(() => [
|
36
|
+
emitter.on("containerSizeRatioUpdate", this.onUpdateContainerSizeRatio),
|
37
|
+
emitter.on("startReconnect", () => {
|
40
38
|
releaseView(this.mainView);
|
41
|
-
})
|
42
|
-
|
39
|
+
}),
|
40
|
+
emitter.on("playgroundSizeChange", rect => {
|
41
|
+
this.synchronizer.setRect(rect);
|
42
|
+
})
|
43
|
+
]);
|
43
44
|
const rect = this.manager.boxManager?.stageRect;
|
44
45
|
if (rect) {
|
45
46
|
this.synchronizer.setRect(rect);
|
46
47
|
}
|
47
|
-
this.sideEffectManager.add(() => {
|
48
|
-
return emitter.on("playgroundSizeChange", rect => {
|
49
|
-
this.synchronizer.setRect(rect);
|
50
|
-
// this.synchronizer.onLocalSizeUpdate(rect);
|
51
|
-
});
|
52
|
-
});
|
53
48
|
}
|
54
49
|
|
55
50
|
private startListenWritableChange = () => {
|
56
|
-
this.sideEffectManager.add(() =>
|
57
|
-
|
51
|
+
this.sideEffectManager.add(() =>
|
52
|
+
emitter.on("writableChange", isWritable => {
|
58
53
|
if (isWritable) {
|
59
54
|
this.ensureCameraAndSize();
|
60
55
|
}
|
61
|
-
})
|
62
|
-
|
56
|
+
})
|
57
|
+
);
|
63
58
|
};
|
64
59
|
|
65
60
|
public ensureCameraAndSize() {
|
@@ -87,14 +82,13 @@ export class MainViewProxy {
|
|
87
82
|
|
88
83
|
public start() {
|
89
84
|
if (this.started) return;
|
90
|
-
this.sizeChangeHandler(this.mainViewSize);
|
91
85
|
this.addCameraListener();
|
92
86
|
this.addCameraReaction();
|
93
87
|
this.started = true;
|
94
88
|
}
|
95
89
|
|
96
90
|
public addCameraReaction = () => {
|
97
|
-
this.manager.refresher
|
91
|
+
this.manager.refresher.add(Fields.MainViewCamera, this.cameraReaction);
|
98
92
|
};
|
99
93
|
|
100
94
|
public setCameraAndSize(): void {
|
@@ -118,15 +112,8 @@ export class MainViewProxy {
|
|
118
112
|
);
|
119
113
|
};
|
120
114
|
|
121
|
-
public sizeChangeHandler = debounce((size: Size) => {
|
122
|
-
if (size) {
|
123
|
-
// this.synchronizer.onLocalSizeUpdate(size);
|
124
|
-
}
|
125
|
-
}, 30);
|
126
|
-
|
127
115
|
public onUpdateContainerSizeRatio = () => {
|
128
116
|
const size = this.store.getMainViewSize();
|
129
|
-
this.sizeChangeHandler(size);
|
130
117
|
if (size.id === this.manager.uid) {
|
131
118
|
this.setCameraAndSize();
|
132
119
|
}
|
@@ -242,8 +229,8 @@ export class MainViewProxy {
|
|
242
229
|
|
243
230
|
public stop() {
|
244
231
|
this.removeCameraListener();
|
245
|
-
this.manager.refresher
|
246
|
-
this.manager.refresher
|
232
|
+
this.manager.refresher.remove(Fields.MainViewCamera);
|
233
|
+
this.manager.refresher.remove(Fields.MainViewSize);
|
247
234
|
this.started = false;
|
248
235
|
}
|
249
236
|
|
package/src/index.ts
CHANGED
@@ -129,8 +129,8 @@ export type MountParams = {
|
|
129
129
|
container?: HTMLElement;
|
130
130
|
/** 白板高宽比例, 默认为 9 / 16 */
|
131
131
|
containerSizeRatio?: number;
|
132
|
-
/**
|
133
|
-
|
132
|
+
/** 是否高亮显示同步区域, 默认为 true */
|
133
|
+
highlightStage?: boolean;
|
134
134
|
collectorContainer?: HTMLElement;
|
135
135
|
collectorStyles?: Partial<CSSStyleDeclaration>;
|
136
136
|
overwriteStyles?: string;
|
@@ -241,6 +241,7 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> imple
|
|
241
241
|
collectorStyles: params.collectorStyles,
|
242
242
|
prefersColorScheme: params.prefersColorScheme,
|
243
243
|
stageRatio: params.containerSizeRatio,
|
244
|
+
highlightStage: params.highlightStage
|
244
245
|
});
|
245
246
|
manager.appManager?.setBoxManager(manager.boxManager);
|
246
247
|
if (params.container) {
|
@@ -504,6 +505,18 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> imple
|
|
504
505
|
}
|
505
506
|
}
|
506
507
|
|
508
|
+
public async jumpPage(index: number): Promise<boolean> {
|
509
|
+
if (!this.appManager) {
|
510
|
+
return false;
|
511
|
+
}
|
512
|
+
if (index < 0 || index >= this.pageState.length) {
|
513
|
+
console.warn(`[WindowManager]: index ${index} out of range`);
|
514
|
+
return false;
|
515
|
+
}
|
516
|
+
await this.appManager.setMainViewSceneIndex(index);
|
517
|
+
return true;
|
518
|
+
}
|
519
|
+
|
507
520
|
public async addPage(params?: AddPageParams): Promise<void> {
|
508
521
|
if (this.appManager) {
|
509
522
|
const after = params?.after;
|
package/dist/View/ViewSync.d.ts
DELETED