|
@@ -1,10 +1,12 @@
|
|
|
import { display, window } from '@kit.ArkUI';
|
|
|
import { common } from '@kit.AbilityKit';
|
|
|
+import { GlobalContext } from '../ContextConfig';
|
|
|
|
|
|
|
|
|
export class WindowHelper {
|
|
|
private constructor() {
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 缓存窗体,关闭时需要
|
|
|
* 同时只能出现一个窗口,所以只做一个缓存就可以
|
|
@@ -78,6 +80,9 @@ export class WindowHelper {
|
|
|
*/
|
|
|
public static set windowClass(value: window.Window | undefined) {
|
|
|
WindowHelper._windowClass = value;
|
|
|
+ if (value) {
|
|
|
+ GlobalContext.setUiContext(value.getUIContext())
|
|
|
+ }
|
|
|
if (WindowHelper._windowClass) {
|
|
|
let avoidArea = WindowHelper._windowClass.getWindowAvoidArea(window.AvoidAreaType.TYPE_NAVIGATION_INDICATOR);
|
|
|
WindowHelper._bottomRectHeight = px2vp(avoidArea.bottomRect.height)
|
|
@@ -114,11 +119,11 @@ export class WindowHelper {
|
|
|
return WindowHelper._isFullScreen ? WindowHelper._topRectHeight : 0
|
|
|
}
|
|
|
|
|
|
- public static get windowsWidth(){
|
|
|
+ public static get windowsWidth() {
|
|
|
return px2vp(display.getDefaultDisplaySync().width)
|
|
|
}
|
|
|
|
|
|
- public static get windowsHeight(){
|
|
|
+ public static get windowsHeight() {
|
|
|
return px2vp(display.getDefaultDisplaySync().height)
|
|
|
}
|
|
|
|