Skip to content
This repository has been archived by the owner on Feb 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #81 from sabresaurus/SafeArea
Browse files Browse the repository at this point in the history
Compatibility update for older than Unity 2017.2. Fixes #80.
  • Loading branch information
Henry00IS authored Apr 2, 2018
2 parents 520791a + a29156c commit 584e494
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Scripts/Brushes/CompoundBrushes/Editor/ShapeEditorWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -986,7 +986,7 @@ private void OnZoomOut()
private void OnHome()
{
// scroll to the center of the screen.
#if UNITY_5_4_OR_NEWER
#if UNITY_2017_2_OR_NEWER
viewportScroll = new Vector2(Screen.safeArea.width / 2.0f / EditorGUIUtility.pixelsPerPoint, Screen.safeArea.height / 2.0f / EditorGUIUtility.pixelsPerPoint);
#else
viewportScroll = new Vector2(Screen.width / 2.0f, Screen.height / 2.0f);
Expand Down Expand Up @@ -1346,7 +1346,7 @@ private void OnToolsBackgroundClearBackground()

private Rect GetViewportRect()
{
#if UNITY_5_4_OR_NEWER
#if UNITY_2017_2_OR_NEWER
Rect viewportRect = Screen.safeArea;
#else
Rect viewportRect = new Rect(0, 0, Screen.width, Screen.height);
Expand Down Expand Up @@ -1476,7 +1476,7 @@ private Vector2 GridPointToScreen(Vector2Int point)
private void ShowCenteredPopupWindowContent(PopupWindowContent popup)
{
Vector2 size = popup.GetWindowSize();
#if UNITY_5_4_OR_NEWER
#if UNITY_2017_2_OR_NEWER
PopupWindow.Show(new Rect((Screen.safeArea.width / 2.0f / EditorGUIUtility.pixelsPerPoint) - (size.x / 2.0f), (Screen.safeArea.height / 2.0f / EditorGUIUtility.pixelsPerPoint) - (size.y / 2.0f), 0, 0), popup);
#else
PopupWindow.Show(new Rect((Screen.width / 2.0f) - (size.x / 2.0f), (Screen.height / 2.0f) - (size.y / 2.0f), 0, 0), popup);
Expand Down

0 comments on commit 584e494

Please sign in to comment.