@@ -16,7 +16,6 @@ public class InlineEditorElement : TriElement
1616 public struct Props
1717 {
1818 public InlineEditorModes mode ;
19- public float previewWidth ;
2019 public float previewHeight ;
2120
2221 public bool DrawGUI => ( mode & InlineEditorModes . GUIOnly ) != 0 ;
@@ -95,7 +94,7 @@ public override void OnGUI(Rect position)
9594 if ( _editor != null && shouldDrawEditor )
9695 {
9796 GUILayout . BeginArea ( _editorPosition ) ;
98- GUILayout . BeginHorizontal ( ) ;
97+ GUILayout . BeginVertical ( ) ;
9998
10099 if ( _props . DrawHeader || _props . DrawGUI )
101100 {
@@ -122,13 +121,8 @@ public override void OnGUI(Rect position)
122121 {
123122 GUILayout . BeginVertical ( ) ;
124123
125- var horizontal = _props . DrawHeader || _props . DrawGUI ;
126-
127- var previewOpts = horizontal
128- ? new [ ] { GUILayout . Width ( _props . previewWidth ) , GUILayout . ExpandHeight ( true ) , }
129- : new [ ] { GUILayout . ExpandWidth ( true ) , GUILayout . Height ( _props . previewHeight ) , } ;
130-
131- var previewRect = GUILayoutUtility . GetRect ( GUIContent . none , GUIStyle . none , previewOpts ) ;
124+ var previewOpts = new [ ] { GUILayout . ExpandWidth ( true ) , GUILayout . Height ( _props . previewHeight ) , } ;
125+ var previewRect = EditorGUILayout . GetControlRect ( false , _props . previewHeight , previewOpts ) ;
132126
133127 previewRect . width = Mathf . Max ( previewRect . width , 10 ) ;
134128 previewRect . height = Mathf . Max ( previewRect . height , 10 ) ;
@@ -143,7 +137,7 @@ public override void OnGUI(Rect position)
143137 GUILayout . EndVertical ( ) ;
144138 }
145139
146- GUILayout . EndHorizontal ( ) ;
140+ GUILayout . EndVertical ( ) ;
147141 lastEditorRect = GUILayoutUtility . GetLastRect ( ) ;
148142 GUILayout . EndArea ( ) ;
149143 }
0 commit comments