Skip to content

Commit db48a43

Browse files
committed
fix(ohos): fix window size
1 parent d410bbc commit db48a43

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

framework/ohos/src/main/ets/support/utils/DimensionsUtil.ets

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,6 @@ export class DimensionsUtil {
3333
private static SHOW_NAV_BAR_RES_NAME = "config_showNavigationBar";
3434
private static NAVIGATE_BAR_HEIGHT = 0;
3535

36-
static async getLastWindowRect(context: Context): Promise<window.Rect> {
37-
const windowObj = await window.getLastWindow(context);
38-
return windowObj.getWindowProperties().windowRect;
39-
}
40-
4136
static async getDimensions(ww: number, wh: number, context: Context): Promise<HippyMap> {
4237
let displayClass: display.Display = display.getDefaultDisplaySync();
4338
await DimensionsUtil.getStatusBarHeight(displayClass);
@@ -47,14 +42,8 @@ export class DimensionsUtil {
4742
let whPixels = wh * displayClass.densityPixels;
4843

4944
if (wwPixels < 0 || whPixels < 0) {
50-
let windowRect = await DimensionsUtil.getLastWindowRect(context);
51-
if (windowRect.width > 0 && windowRect.height > 0) {
52-
wwPixels = windowRect.width;
53-
whPixels = windowRect.height;
54-
} else {
55-
wwPixels = displayClass.width;
56-
whPixels = displayClass.height;
57-
}
45+
wwPixels = displayClass.width;
46+
whPixels = displayClass.height;
5847
}
5948

6049
let windowDisplayMetricsMap = new Map<string, HippyValue>()

0 commit comments

Comments
 (0)