From 02c3055e11e53788fcbfd2c474f51db325dd6664 Mon Sep 17 00:00:00 2001 From: ALEXTANG <574809918@qq.com> Date: Tue, 9 May 2023 23:14:49 +0800 Subject: [PATCH] Update SafeTop.cs --- .../Runtime/Extension/UGUIExtension/MonoExtend/SafeTop.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Assets/TEngine/Runtime/Extension/UGUIExtension/MonoExtend/SafeTop.cs b/Assets/TEngine/Runtime/Extension/UGUIExtension/MonoExtend/SafeTop.cs index bfa79464..edc737b6 100644 --- a/Assets/TEngine/Runtime/Extension/UGUIExtension/MonoExtend/SafeTop.cs +++ b/Assets/TEngine/Runtime/Extension/UGUIExtension/MonoExtend/SafeTop.cs @@ -19,10 +19,14 @@ namespace TEngine private static float _notchHeight; - public static void CheckNotch(bool applyEditorNotch = false) + public static void CheckNotch(bool applyEditorNotch = true) { #if UNITY_EDITOR _notchHeight = applyEditorNotch ? Screen.safeArea.y > 0f ? Screen.safeArea.y : Screen.currentResolution.height - Screen.safeArea.height : 0f; + if (_notchHeight < 0) + { + _notchHeight = 0; + } #else _notchHeight = Screen.safeArea.y > 0f ? Screen.safeArea.y : Screen.currentResolution.height - Screen.currentResolution.height; #endif