Skip to content

Commit

Permalink
fix for scrolling in 2019
Browse files Browse the repository at this point in the history
  • Loading branch information
gwaredd committed Nov 9, 2019
1 parent d9b4d3e commit b0e7812
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions Editor/Scripts/MarkdownViewer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,26 @@ Layout ParseDocument()

//------------------------------------------------------------------------------

#if UNITY_2019
private float mHeight = 1.0f;
#endif

protected Rect GetEditorRect()
{
#if UNITY_2019
var height = Screen.height - 138.0f; // TODO: need better way of getting height!
GUILayout.Space( height );
return new Rect( 0.0f, 4.0f, EditorGUIUtility.currentViewWidth, height );

// calculate working space
if( Event.current.type == EventType.Layout )
{
var offset = 32.0f + 96.0f + 4.0f; // tab height + asset labels height + offset
mHeight = ( Screen.height - offset ) / 1.5115f;
}

// reserve space (we are going to paint on it directly)
GUILayout.Space( mHeight );

// return working rect
return new Rect( 0.0f, 4.0f, EditorGUIUtility.currentViewWidth, mHeight );
#else
GUILayout.FlexibleSpace();
var rectContainer = GUILayoutUtility.GetLastRect();
Expand Down

0 comments on commit b0e7812

Please sign in to comment.