@netless/window-manager 0.3.12-canary.1 → 0.3.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/MainView.d.ts +8 -0
- package/dist/index.d.ts +3 -1
- 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 +1 -1
- package/src/MainView.ts +11 -0
- package/src/index.ts +11 -1
package/package.json
CHANGED
package/src/MainView.ts
CHANGED
@@ -88,6 +88,10 @@ export class MainViewProxy extends Base {
|
|
88
88
|
return this.mainView;
|
89
89
|
}
|
90
90
|
|
91
|
+
public get cameraState() {
|
92
|
+
return { ...this.view.camera, ...this.view.size };
|
93
|
+
}
|
94
|
+
|
91
95
|
public createMainView(): View {
|
92
96
|
const mainView = createView(this.manager.displayer);
|
93
97
|
mainView.callbacks.on("onSizeUpdated", () => {
|
@@ -139,6 +143,7 @@ export class MainViewProxy extends Base {
|
|
139
143
|
|
140
144
|
private sizeListener = (size: Size) => {
|
141
145
|
this.setMainViewSize(size);
|
146
|
+
callbacks.emit("cameraStateChange", this.cameraState);
|
142
147
|
};
|
143
148
|
|
144
149
|
public setMainViewSize = debounce(size => {
|
@@ -147,10 +152,16 @@ export class MainViewProxy extends Base {
|
|
147
152
|
|
148
153
|
private addCameraListener() {
|
149
154
|
this.view.callbacks.on("onCameraUpdatedByDevice", this.cameraListener);
|
155
|
+
this.view.callbacks.on("onCameraUpdated", this.cameraStateChangeListener);
|
150
156
|
}
|
151
157
|
|
152
158
|
private removeCameraListener() {
|
153
159
|
this.view.callbacks.off("onCameraUpdatedByDevice", this.cameraListener);
|
160
|
+
this.view.callbacks.off("onCameraUpdated", this.cameraStateChangeListener)
|
161
|
+
}
|
162
|
+
|
163
|
+
private cameraStateChangeListener = () => {
|
164
|
+
callbacks.emit("cameraStateChange", this.cameraState);
|
154
165
|
}
|
155
166
|
|
156
167
|
public switchViewModeToWriter(): void {
|
package/src/index.ts
CHANGED
@@ -51,6 +51,7 @@ import type {
|
|
51
51
|
Point,
|
52
52
|
Rectangle,
|
53
53
|
ViewVisionMode,
|
54
|
+
CameraState,
|
54
55
|
} from "white-web-sdk";
|
55
56
|
import type { AppListeners } from "./AppListener";
|
56
57
|
import type { NetlessApp, RegisterParams } from "./typings";
|
@@ -143,6 +144,7 @@ export type PublicEvent = {
|
|
143
144
|
boxStateChange: `${TELE_BOX_STATE}`;
|
144
145
|
darkModeChange: boolean;
|
145
146
|
prefersColorSchemeChange: TeleBoxColorScheme;
|
147
|
+
cameraStateChange: CameraState;
|
146
148
|
};
|
147
149
|
|
148
150
|
export type MountParams = {
|
@@ -173,7 +175,7 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> {
|
|
173
175
|
public static containerSizeRatio = DEFAULT_CONTAINER_RATIO;
|
174
176
|
private static isCreated = false;
|
175
177
|
|
176
|
-
public version = "0.3.12
|
178
|
+
public version = "0.3.12";
|
177
179
|
|
178
180
|
public appListeners?: AppListeners;
|
179
181
|
|
@@ -515,6 +517,14 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> {
|
|
515
517
|
}
|
516
518
|
}
|
517
519
|
|
520
|
+
public get cameraState(): CameraState {
|
521
|
+
if (this.appManager) {
|
522
|
+
return this.appManager.mainViewProxy.cameraState;
|
523
|
+
} else {
|
524
|
+
throw new AppManagerNotInitError();
|
525
|
+
}
|
526
|
+
}
|
527
|
+
|
518
528
|
public get apps(): Apps | undefined {
|
519
529
|
return this.appManager?.store.apps();
|
520
530
|
}
|