Update SafeTop.cs

This commit is contained in:
ALEXTANG
2023-05-09 23:14:49 +08:00
parent 2f76cc012c
commit 02c3055e11

View File

@@ -19,10 +19,14 @@ namespace TEngine
private static float _notchHeight; private static float _notchHeight;
public static void CheckNotch(bool applyEditorNotch = false) public static void CheckNotch(bool applyEditorNotch = true)
{ {
#if UNITY_EDITOR #if UNITY_EDITOR
_notchHeight = applyEditorNotch ? Screen.safeArea.y > 0f ? Screen.safeArea.y : Screen.currentResolution.height - Screen.safeArea.height : 0f; _notchHeight = applyEditorNotch ? Screen.safeArea.y > 0f ? Screen.safeArea.y : Screen.currentResolution.height - Screen.safeArea.height : 0f;
if (_notchHeight < 0)
{
_notchHeight = 0;
}
#else #else
_notchHeight = Screen.safeArea.y > 0f ? Screen.safeArea.y : Screen.currentResolution.height - Screen.currentResolution.height; _notchHeight = Screen.safeArea.y > 0f ? Screen.safeArea.y : Screen.currentResolution.height - Screen.currentResolution.height;
#endif #endif