@netless/window-manager 1.0.0-canary.37 → 1.0.0-canary.38
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/index.cjs.js +8 -8
- package/dist/index.es.js +10 -50
- package/dist/index.umd.js +8 -8
- package/dist/src/index.d.ts +1 -4
- package/package.json +1 -1
- package/src/View/CameraSynchronizer.ts +8 -5
- package/src/View/ViewSync.ts +1 -1
- package/src/index.ts +59 -48
package/dist/src/index.d.ts
CHANGED
@@ -5,7 +5,7 @@ import { ReconnectRefresher } from "./ReconnectRefresher";
|
|
5
5
|
import { Val } from "value-enhancer";
|
6
6
|
import type { TELE_BOX_STATE } from "./BoxManager";
|
7
7
|
import type { Apps, Position, ICamera, ISize } from "./AttributesDelegate";
|
8
|
-
import type { Displayer, SceneDefinition, View, Room, InvisiblePluginContext, Camera, CameraBound, Point, CameraState, Player, ImageInformation, SceneState,
|
8
|
+
import type { Displayer, SceneDefinition, View, Room, InvisiblePluginContext, Camera, CameraBound, Point, CameraState, Player, ImageInformation, SceneState, Size } from "white-web-sdk";
|
9
9
|
import type { AppListeners } from "./AppListener";
|
10
10
|
import type { ApplianceIcons, NetlessApp, RegisterParams } from "./typings";
|
11
11
|
import type { TeleBoxColorScheme, TeleBoxFullscreen, TeleBoxManagerThemeConfig, TeleBoxState } from "@netless/telebox-insider";
|
@@ -233,9 +233,6 @@ export declare class WindowManager extends InvisiblePlugin<WindowMangerAttribute
|
|
233
233
|
moveCamera(camera: Partial<Camera> & {
|
234
234
|
animationMode?: AnimationMode;
|
235
235
|
}): void;
|
236
|
-
moveCameraToContain(rectangle: Rectangle & {
|
237
|
-
animationMode?: AnimationMode;
|
238
|
-
}): void;
|
239
236
|
convertToPointInWorld(point: Point): Point;
|
240
237
|
setCameraBound(cameraBound: CameraBound): void;
|
241
238
|
onDestroy(): void;
|
package/package.json
CHANGED
@@ -48,11 +48,14 @@ export class CameraSynchronizer {
|
|
48
48
|
this.remoteSize = size;
|
49
49
|
const needMoveCamera = !isEqual(pick(this.rect, ["width", "height"]), pick(size, ["width", "height"]));
|
50
50
|
if (this.rect && this.remoteCamera && needMoveCamera) {
|
51
|
-
|
52
|
-
const
|
53
|
-
this.
|
54
|
-
|
55
|
-
|
51
|
+
if (!this.view) return;
|
52
|
+
const currentCamera = this.view.camera;
|
53
|
+
this.view?.moveCameraToContain({
|
54
|
+
width: size.width,
|
55
|
+
height: size.height,
|
56
|
+
originX: currentCamera.centerX - (size.width / 2),
|
57
|
+
originY: currentCamera.centerY - (size.height / 2),
|
58
|
+
});
|
56
59
|
}
|
57
60
|
}
|
58
61
|
|
package/src/View/ViewSync.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { ViewMode, AnimationMode
|
1
|
+
import { ViewMode, AnimationMode } from "white-web-sdk";
|
2
2
|
import { CameraSynchronizer, computedMinScale } from "./CameraSynchronizer";
|
3
3
|
import { combine } from "value-enhancer";
|
4
4
|
import { SideEffectManager } from "side-effect-manager";
|
package/src/index.ts
CHANGED
@@ -10,7 +10,7 @@ import { emitter } from "./InternalEmitter";
|
|
10
10
|
import { Fields } from "./AttributesDelegate";
|
11
11
|
import { initDb } from "./Register/storage";
|
12
12
|
import { AnimationMode, InvisiblePlugin, isPlayer, isRoom, RoomPhase, ViewMode } from "white-web-sdk";
|
13
|
-
import { isEqual, isNull, isObject, isNumber
|
13
|
+
import { isEqual, isNull, isObject, isNumber } from "lodash";
|
14
14
|
import { log } from "./Utils/log";
|
15
15
|
import { PageStateImpl } from "./PageState";
|
16
16
|
import { ReconnectRefresher } from "./ReconnectRefresher";
|
@@ -44,7 +44,6 @@ import type {
|
|
44
44
|
Player,
|
45
45
|
ImageInformation,
|
46
46
|
SceneState,
|
47
|
-
Rectangle,
|
48
47
|
Size
|
49
48
|
} from "white-web-sdk";
|
50
49
|
import type { AppListeners } from "./AppListener";
|
@@ -835,52 +834,64 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> imple
|
|
835
834
|
}
|
836
835
|
}
|
837
836
|
|
838
|
-
public moveCameraToContain(rectangle: Rectangle & { animationMode?: AnimationMode }): void {
|
839
|
-
|
840
|
-
|
841
|
-
|
842
|
-
|
843
|
-
|
844
|
-
|
845
|
-
|
846
|
-
|
847
|
-
|
848
|
-
|
849
|
-
|
850
|
-
|
851
|
-
|
852
|
-
|
853
|
-
|
854
|
-
|
855
|
-
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
|
860
|
-
|
861
|
-
|
862
|
-
|
863
|
-
|
864
|
-
|
865
|
-
|
866
|
-
|
867
|
-
|
868
|
-
|
869
|
-
|
870
|
-
|
871
|
-
|
872
|
-
|
873
|
-
|
874
|
-
|
875
|
-
|
876
|
-
|
877
|
-
|
878
|
-
|
879
|
-
|
880
|
-
|
881
|
-
|
882
|
-
|
883
|
-
|
837
|
+
// public moveCameraToContain(rectangle: Rectangle & { animationMode?: AnimationMode }): void {
|
838
|
+
// this.setBaseSize(rectangle);
|
839
|
+
// const centerX = rectangle.originX + (rectangle.width / 2);
|
840
|
+
// const centerY = rectangle.originY + (rectangle.height / 2);
|
841
|
+
// setTimeout(() => {
|
842
|
+
// this.moveCamera({ centerX, centerY, animationMode: rectangle.animationMode });
|
843
|
+
// }, 500);
|
844
|
+
// // if (!this.appManager) return;
|
845
|
+
// // const camera: Partial<Camera> = {};
|
846
|
+
// // if (isNumber(rectangle.originX)) {
|
847
|
+
// // camera.centerX = rectangle.originX;
|
848
|
+
// // }
|
849
|
+
// // if (isNumber(rectangle.originY)) {
|
850
|
+
// // camera.centerY = rectangle.originY;
|
851
|
+
// // }
|
852
|
+
// // if (rectangle.animationMode === AnimationMode.Immediately) {
|
853
|
+
// // this.appManager.mainViewProxy.storeSize({
|
854
|
+
// // id: this.appManager.uid,
|
855
|
+
// // width: rectangle.width,
|
856
|
+
// // height: rectangle.height,
|
857
|
+
// // });
|
858
|
+
// // this.mainView.moveCameraToContain(rectangle);
|
859
|
+
// // if (!isEmpty(camera) && this.appManager.mainViewProxy.camera$.value) {
|
860
|
+
// // this.appManager.mainViewProxy.storeCamera({
|
861
|
+
// // ...this.appManager.mainViewProxy.camera$.value,
|
862
|
+
// // id: this.appManager.uid,
|
863
|
+
// // centerX: this.mainView.camera.centerX,
|
864
|
+
// // centerY: this.mainView.camera.centerY
|
865
|
+
// // });
|
866
|
+
// // }
|
867
|
+
// // } else {
|
868
|
+
// // this.appManager.dispatchInternalEvent(Events.MoveCameraToContain, rectangle);
|
869
|
+
// // this.mainView.moveCameraToContain(rectangle);
|
870
|
+
// // if (!this.baseCamera) return;
|
871
|
+
// // const remoteSize = rectangle;
|
872
|
+
// // const currentSize = this.boxManager?.stageRect;
|
873
|
+
// // if (!currentSize) return;
|
874
|
+
// // const nextScale = this.baseCamera.scale * computedMinScale(remoteSize, currentSize);
|
875
|
+
// // setTimeout(() => {
|
876
|
+
// // if (!this.appManager) return;
|
877
|
+
// // this.appManager.mainViewProxy.storeSize({
|
878
|
+
// // id: this.appManager.uid,
|
879
|
+
// // width: rectangle.width,
|
880
|
+
// // height: rectangle.height,
|
881
|
+
// // });
|
882
|
+
|
883
|
+
// // if (!isEmpty(camera) && this.appManager.mainViewProxy.camera$.value) {
|
884
|
+
// // this.appManager.mainViewProxy.storeCamera({
|
885
|
+
// // ...this.appManager.mainViewProxy.camera$.value,
|
886
|
+
// // id: this.appManager.uid,
|
887
|
+
// // centerX: this.mainView.camera.centerX,
|
888
|
+
// // centerY: this.mainView.camera.centerY,
|
889
|
+
// // scale: nextScale
|
890
|
+
// // });
|
891
|
+
// // }
|
892
|
+
// // }, 500);
|
893
|
+
// // }
|
894
|
+
// }
|
884
895
|
|
885
896
|
public convertToPointInWorld(point: Point): Point {
|
886
897
|
return this.mainView.convertToPointInWorld(point);
|