@netless/window-manager 0.4.0-canary.11 → 0.4.0-canary.12
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/AppProxy.d.ts +1 -0
- package/dist/index.es.js +1 -1
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -2
- package/src/AppContext.ts +2 -0
- package/src/AppManager.ts +3 -0
- package/src/AppProxy.ts +24 -11
- package/src/index.ts +1 -1
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@netless/window-manager",
|
3
|
-
"version": "0.4.0-canary.
|
3
|
+
"version": "0.4.0-canary.12",
|
4
4
|
"description": "",
|
5
5
|
"main": "dist/index.es.js",
|
6
6
|
"module": "dist/index.es.js",
|
@@ -19,7 +19,7 @@
|
|
19
19
|
"license": "ISC",
|
20
20
|
"peerDependencies": {
|
21
21
|
"video.js": ">=7",
|
22
|
-
"white-web-sdk": "^2.
|
22
|
+
"white-web-sdk": "^2.16.0"
|
23
23
|
},
|
24
24
|
"dependencies": {
|
25
25
|
"@juggle/resize-observer": "^3.3.1",
|
package/src/AppContext.ts
CHANGED
@@ -110,6 +110,8 @@ export class AppContext<TAttributes = any, TMagixEventPayloads = any, TAppOption
|
|
110
110
|
public setScenePath = async (scenePath: string): Promise<void> => {
|
111
111
|
if (!this.appProxy.box) return;
|
112
112
|
this.appProxy.setFullPath(scenePath);
|
113
|
+
// 兼容 15 版本 SDK 的切页
|
114
|
+
this.getRoom()?.setScenePath(scenePath);
|
113
115
|
}
|
114
116
|
|
115
117
|
public mountView = (dom: HTMLDivElement): void => {
|
package/src/AppManager.ts
CHANGED
@@ -318,6 +318,9 @@ export class AppManager {
|
|
318
318
|
});
|
319
319
|
if (isWritable === true) {
|
320
320
|
this.mainView.disableCameraTransform = false;
|
321
|
+
if (this.room && this.room.disableSerialization === true) {
|
322
|
+
this.room.disableSerialization = false;
|
323
|
+
}
|
321
324
|
} else {
|
322
325
|
this.mainView.disableCameraTransform = true;
|
323
326
|
}
|
package/src/AppProxy.ts
CHANGED
@@ -5,13 +5,9 @@ import { appRegister } from "./Register";
|
|
5
5
|
import { autorun } from "white-web-sdk";
|
6
6
|
import { emitter } from "./index";
|
7
7
|
import { Fields } from "./AttributesDelegate";
|
8
|
-
import { get } from "lodash";
|
8
|
+
import { debounce, get } from "lodash";
|
9
9
|
import { log } from "./Utils/log";
|
10
|
-
import {
|
11
|
-
setScenePath,
|
12
|
-
setViewFocusScenePath,
|
13
|
-
getScenePath
|
14
|
-
} from "./Utils/Common";
|
10
|
+
import { setScenePath, setViewFocusScenePath, getScenePath } from "./Utils/Common";
|
15
11
|
import type {
|
16
12
|
AppEmitterEvent,
|
17
13
|
AppInitState,
|
@@ -113,9 +109,7 @@ export class AppProxy extends Base {
|
|
113
109
|
this.manager.safeUpdateAttributes(["apps", this.id, Fields.FullPath], path);
|
114
110
|
}
|
115
111
|
|
116
|
-
public async baseInsertApp(
|
117
|
-
skipUpdate = false,
|
118
|
-
): Promise<{ appId: string; app: NetlessApp }> {
|
112
|
+
public async baseInsertApp(skipUpdate = false): Promise<{ appId: string; app: NetlessApp }> {
|
119
113
|
const params = this.params;
|
120
114
|
if (!params.kind) {
|
121
115
|
throw new Error("[WindowManager]: kind require");
|
@@ -123,7 +117,13 @@ export class AppProxy extends Base {
|
|
123
117
|
const appImpl = await appRegister.appClasses.get(params.kind)?.();
|
124
118
|
const appParams = appRegister.registered.get(params.kind);
|
125
119
|
if (appImpl) {
|
126
|
-
await this.setupApp(
|
120
|
+
await this.setupApp(
|
121
|
+
this.id,
|
122
|
+
skipUpdate,
|
123
|
+
appImpl,
|
124
|
+
params.options,
|
125
|
+
appParams?.appOptions
|
126
|
+
);
|
127
127
|
} else {
|
128
128
|
throw new Error(`[WindowManager]: app load failed ${params.kind} ${params.src}`);
|
129
129
|
}
|
@@ -317,7 +317,7 @@ export class AppProxy extends Base {
|
|
317
317
|
}
|
318
318
|
});
|
319
319
|
});
|
320
|
-
this.manager.refresher?.add(this.stateKey,() => {
|
320
|
+
this.manager.refresher?.add(this.stateKey, () => {
|
321
321
|
return autorun(() => {
|
322
322
|
const appState = this.appAttributes?.state;
|
323
323
|
if (appState?.zIndex > 0 && appState.zIndex !== this.box?.zIndex) {
|
@@ -325,8 +325,20 @@ export class AppProxy extends Base {
|
|
325
325
|
}
|
326
326
|
});
|
327
327
|
});
|
328
|
+
this.manager.refresher?.add(`${appId}-fullPath`, () => {
|
329
|
+
return autorun(() => {
|
330
|
+
const fullPath = this.appAttributes.fullPath;
|
331
|
+
this.setFocusScenePathHandler(fullPath);
|
332
|
+
});
|
333
|
+
});
|
328
334
|
};
|
329
335
|
|
336
|
+
private setFocusScenePathHandler = debounce((fullPath: string | undefined) => {
|
337
|
+
if (this.view && fullPath && fullPath !== this.view?.focusScenePath) {
|
338
|
+
setViewFocusScenePath(this.view, fullPath);
|
339
|
+
}
|
340
|
+
}, 50);
|
341
|
+
|
330
342
|
public setScenePath(): void {
|
331
343
|
if (!this.manager.canOperate) return;
|
332
344
|
const fullScenePath = this.getFullScenePath();
|
@@ -372,6 +384,7 @@ export class AppProxy extends Base {
|
|
372
384
|
this.manager.appStatus.delete(this.id);
|
373
385
|
this.manager.refresher?.remove(this.id);
|
374
386
|
this.manager.refresher?.remove(this.stateKey);
|
387
|
+
this.manager.refresher?.remove(`${this.id}-fullPath`);
|
375
388
|
}
|
376
389
|
|
377
390
|
public close(): Promise<void> {
|
package/src/index.ts
CHANGED
@@ -220,7 +220,7 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> {
|
|
220
220
|
if (room.phase !== RoomPhase.Connected) {
|
221
221
|
throw new Error("[WindowManager]: Room only Connected can be mount");
|
222
222
|
}
|
223
|
-
if (room.phase === RoomPhase.Connected) {
|
223
|
+
if (room.phase === RoomPhase.Connected && room.isWritable) {
|
224
224
|
// redo undo 需要设置这个属性
|
225
225
|
room.disableSerialization = false;
|
226
226
|
}
|