Skip to content

Commit

Permalink
Update src/Core/src/Platform/Tizen/WindowExtensions.cs
Browse files Browse the repository at this point in the history
Co-authored-by: Kangho Hur <kangho.hur@samsung.com>
  • Loading branch information
PureWeen and rookiejava committed May 20, 2022
1 parent 3f870e2 commit f3957aa
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/Core/src/Platform/Tizen/WindowExtensions.cs
Expand Up @@ -111,14 +111,17 @@ static void OnBackButtonPressed(Window window)
s_windowCloseRequestHandler[window].Invoke();
}

internal static Devices.DisplayOrientation GetOrientation(this IWindow window) =>
window.Handler?.MauiContext?.GetPlatformWindow()?.Rotation switch
internal static Devices.DisplayOrientation GetOrientation(this IWindow window)
{
bool isTV = Elementary.GetProfile() == "tv";
return window.Handler?.MauiContext?.GetPlatformWindow()?.Rotation switch
{
0 => Devices.DisplayOrientation.Portrait,
90 => Devices.DisplayOrientation.Landscape,
180 => Devices.DisplayOrientation.Portrait,
270 => Devices.DisplayOrientation.Landscape,
0 => isTV ? Devices.DisplayOrientation.Landscape : Devices.DisplayOrientation.Portrait,
90 => isTV ? Devices.DisplayOrientation.Portrait : Devices.DisplayOrientation.Landscape,
180 => isTV ? Devices.DisplayOrientation.Landscape : Devices.DisplayOrientation.Portrait,
270 => isTV ? Devices.DisplayOrientation.Portrait : Devices.DisplayOrientation.Landscape,
_ => Devices.DisplayOrientation.Unknown
};
}
}
}

0 comments on commit f3957aa

Please sign in to comment.