43 lines
1.5 KiB
Plaintext
43 lines
1.5 KiB
Plaintext
import { AppStorageV2, window} from '@kit.ArkUI';
|
|
|
|
//该文档主要储存屏幕信息,主窗口信息,窗口管理信息
|
|
//底部有全局信息变量,已导出,其他page只需要import该文件即可调用let变量
|
|
@ObservedV2
|
|
export class MainScreenDisplayInfo {
|
|
@Trace public mainScreenDisplayId: number;
|
|
@Trace public mainScreenWidth: number;
|
|
@Trace public mainScreenHeight: number;
|
|
|
|
constructor(_id?: number, _width?: number,_height?: number) {
|
|
this.mainScreenDisplayId = _id ?? 0;
|
|
this.mainScreenWidth = _width ?? 0;
|
|
this.mainScreenHeight = _height ?? 0;
|
|
}
|
|
}
|
|
|
|
@ObservedV2
|
|
export class MainWindowInfo {
|
|
@Trace public mainWindowWidth: number;
|
|
@Trace public mainWindowHeight: number;
|
|
|
|
constructor(_width?: number, _height?: number) {
|
|
this.mainWindowWidth = _width ?? 0;
|
|
this.mainWindowHeight = _height ?? 0;
|
|
}
|
|
}
|
|
|
|
@ObservedV2
|
|
export class MainWindowStageInfo {
|
|
@Trace public ws: window.WindowStage| undefined;
|
|
|
|
constructor(_ws?: window.WindowStage) {
|
|
this.ws = _ws ?? undefined;
|
|
}
|
|
}
|
|
//全局保存主窗口信息,屏幕信息.窗口管理器信息
|
|
export let mwInfo: MainWindowInfo = AppStorageV2.connect<MainWindowInfo>(MainWindowInfo, () => new MainWindowInfo())!;
|
|
export let msdInfo: MainScreenDisplayInfo = AppStorageV2.connect<MainScreenDisplayInfo>(MainScreenDisplayInfo, () => new MainScreenDisplayInfo())!;
|
|
export let mwsInfo: MainWindowStageInfo = AppStorageV2.connect<MainWindowStageInfo>(MainWindowStageInfo, () => new MainWindowStageInfo())!;
|
|
|
|
|