Skip to content

Commit

Permalink
feat: (macOS) Add CurrentOrientation support
Browse files Browse the repository at this point in the history
  • Loading branch information
ajpinedam committed Apr 14, 2020
1 parent dfd6cea commit 1d0a89a
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/Uno.UWP/Graphics/Display/DisplayInformation.macOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ private void UpdateProperties()
UpdateLogicalProperties();
UpdateRawProperties();
UpdateNativeOrientation();
UpdateCurrentOrientation();
}

private void UpdateLogicalProperties()
Expand Down Expand Up @@ -42,5 +43,17 @@ private void UpdateNativeOrientation()
{
NativeOrientation = DisplayOrientations.Landscape;
}

private void UpdateCurrentOrientation()
{
if (NSScreen.MainScreen.Frame.Width > NSScreen.MainScreen.Frame.Height)
{
CurrentOrientation = DisplayOrientations.Landscape;
}
else
{
CurrentOrientation = DisplayOrientations.Portrait;
}
}
}
}

0 comments on commit 1d0a89a

Please sign in to comment.