@netless/window-manager 0.4.25 → 0.4.26
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/CHANGELOG.md +5 -0
- package/dist/App/AppProxy.d.ts +1 -0
- package/dist/InternalEmitter.d.ts +2 -1
- package/dist/View/MainView.d.ts +1 -0
- package/dist/index.cjs.js +10 -10
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +28 -7
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +10 -10
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/App/AppProxy.ts +6 -1
- package/src/InternalEmitter.ts +2 -1
- package/src/ReconnectRefresher.ts +4 -1
- package/src/View/MainView.ts +20 -5
package/package.json
CHANGED
package/src/App/AppProxy.ts
CHANGED
@@ -48,6 +48,7 @@ export class AppProxy {
|
|
48
48
|
private status: "normal" | "destroyed" = "normal";
|
49
49
|
private stateKey: string;
|
50
50
|
private _pageState: AppPageStateImpl;
|
51
|
+
private _prevFullPath: string | undefined;
|
51
52
|
|
52
53
|
public appResult?: NetlessApp<any>;
|
53
54
|
public appContext?: AppContext<any, any>;
|
@@ -348,7 +349,10 @@ export class AppProxy {
|
|
348
349
|
return autorun(() => {
|
349
350
|
const fullPath = this.appAttributes?.fullPath;
|
350
351
|
this.setFocusScenePathHandler(fullPath);
|
351
|
-
this.
|
352
|
+
if (this._prevFullPath !== fullPath) {
|
353
|
+
this.notifyPageStateChange();
|
354
|
+
this._prevFullPath = fullPath;
|
355
|
+
}
|
352
356
|
});
|
353
357
|
});
|
354
358
|
};
|
@@ -432,6 +436,7 @@ export class AppProxy {
|
|
432
436
|
this.manager.refresher?.remove(this.id);
|
433
437
|
this.manager.refresher?.remove(this.stateKey);
|
434
438
|
this.manager.refresher?.remove(`${this.id}-fullPath`);
|
439
|
+
this._prevFullPath = undefined;
|
435
440
|
}
|
436
441
|
|
437
442
|
public close(): Promise<void> {
|
package/src/InternalEmitter.ts
CHANGED
@@ -16,7 +16,8 @@ export type EmitterEvent = {
|
|
16
16
|
observerIdChange: number;
|
17
17
|
boxStateChange: string;
|
18
18
|
playgroundSizeChange: DOMRect;
|
19
|
-
|
19
|
+
startReconnect: undefined;
|
20
|
+
onReconnected: undefined;
|
20
21
|
removeScenes: string;
|
21
22
|
cursorMove: CursorMovePayload;
|
22
23
|
updateManagerRect: undefined;
|
@@ -29,6 +29,9 @@ export class ReconnectRefresher {
|
|
29
29
|
}
|
30
30
|
|
31
31
|
private onPhaseChanged = (phase: RoomPhase) => {
|
32
|
+
if (phase === RoomPhase.Reconnecting) {
|
33
|
+
this.ctx.emitter.emit("startReconnect");
|
34
|
+
}
|
32
35
|
if (phase === RoomPhase.Connected && this.phase === RoomPhase.Reconnecting) {
|
33
36
|
this.onReconnected();
|
34
37
|
}
|
@@ -47,7 +50,7 @@ export class ReconnectRefresher {
|
|
47
50
|
this.disposers.set(id, func());
|
48
51
|
}
|
49
52
|
});
|
50
|
-
this.ctx.emitter.emit("onReconnected"
|
53
|
+
this.ctx.emitter.emit("onReconnected");
|
51
54
|
}
|
52
55
|
|
53
56
|
private releaseDisposers() {
|
package/src/View/MainView.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { AnimationMode, reaction } from "white-web-sdk";
|
2
2
|
import { callbacks } from "../callback";
|
3
3
|
import { createView } from "./ViewManager";
|
4
|
-
import { debounce, isEmpty, isEqual } from "lodash";
|
4
|
+
import { debounce, get, isEmpty, isEqual } from "lodash";
|
5
5
|
import { emitter } from "../InternalEmitter";
|
6
6
|
import { Fields } from "../AttributesDelegate";
|
7
7
|
import { setViewFocusScenePath } from "../Utils/Common";
|
@@ -37,6 +37,11 @@ export class MainViewProxy {
|
|
37
37
|
this.sideEffectManager.add(() => {
|
38
38
|
return emitter.on("containerSizeRatioUpdate", this.onUpdateContainerSizeRatio);
|
39
39
|
});
|
40
|
+
this.sideEffectManager.add(() => {
|
41
|
+
return emitter.on("startReconnect", () => {
|
42
|
+
this.mainView.release();
|
43
|
+
});
|
44
|
+
});
|
40
45
|
}
|
41
46
|
|
42
47
|
private startListenWritableChange = () => {
|
@@ -64,6 +69,10 @@ export class MainViewProxy {
|
|
64
69
|
return this.store.getMainViewSize();
|
65
70
|
}
|
66
71
|
|
72
|
+
private get didRelease(): boolean {
|
73
|
+
return get(this.view, ["didRelease"]);
|
74
|
+
}
|
75
|
+
|
67
76
|
private moveCameraSizeByAttributes() {
|
68
77
|
this.moveCameraToContian(this.mainViewSize);
|
69
78
|
this.moveCamera(this.mainViewCamera);
|
@@ -133,9 +142,13 @@ export class MainViewProxy {
|
|
133
142
|
}
|
134
143
|
|
135
144
|
public onReconnect(): void {
|
136
|
-
|
137
|
-
|
138
|
-
|
145
|
+
if (this.didRelease) {
|
146
|
+
this.rebind();
|
147
|
+
} else {
|
148
|
+
const mainViewScenePath = this.store.getMainViewScenePath();
|
149
|
+
if (mainViewScenePath) {
|
150
|
+
setViewFocusScenePath(this.view, mainViewScenePath);
|
151
|
+
}
|
139
152
|
}
|
140
153
|
}
|
141
154
|
|
@@ -143,7 +156,9 @@ export class MainViewProxy {
|
|
143
156
|
const divElement = this.mainView.divElement;
|
144
157
|
const disableCameraTransform = this.mainView.disableCameraTransform;
|
145
158
|
this.stop();
|
146
|
-
this.
|
159
|
+
if (!this.didRelease) {
|
160
|
+
this.mainView.release();
|
161
|
+
}
|
147
162
|
this.removeMainViewListener();
|
148
163
|
this.mainView = this.createMainView();
|
149
164
|
this.mainView.disableCameraTransform = disableCameraTransform;
|