From cf3ee52e6831b507a4ae4182cc1d9e9e758698c2 Mon Sep 17 00:00:00 2001 From: xiekaidong Date: Wed, 26 Apr 2023 21:19:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=98=E6=B5=B7=E5=B1=8F=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/common/safe_area_manager.lua | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/lua/app/common/safe_area_manager.lua b/lua/app/common/safe_area_manager.lua index f96eed4d..3ce433f6 100644 --- a/lua/app/common/safe_area_manager.lua +++ b/lua/app/common/safe_area_manager.lua @@ -7,19 +7,17 @@ local DESIGN_HEIGHT = 1280 -- 获取刘海高度 function SafeAreaManager:getNotchScreenHeight() - -- local notchHeight = CS.BF.SafeAreaManager.GetNotchScreenHeight() - -- local width, height = GFunc.getScreenSize() - -- local sw = width / DESIGN_WIDTH -- 0.64 - -- local sh = height / DESIGN_HEIGHT -- 0.52 - -- local minScale = 1 - -- if sw < sh then - -- minScale = sw - -- else - -- minScale = sh - -- end - -- return notchHeight / minScale - -- 此项目不用处理刘海屏适配 - return 0 + local notchHeight = CS.BF.SafeAreaManager.GetNotchScreenHeight() + local width, height = GFunc.getScreenSize() + local sw = width / DESIGN_WIDTH -- 0.64 + local sh = height / DESIGN_HEIGHT -- 0.52 + local minScale = 1 + if sw < sh then + minScale = sw + else + minScale = sh + end + return notchHeight / minScale end return SafeAreaManager \ No newline at end of file