mirror of
https://github.com/codewriter-packages/Tri-Inspector.git
synced 2025-01-22 00:08:51 -05:00
Fix InlineEditor preview layout
This commit is contained in:
parent
19b6729b97
commit
0c5b8f4480
@ -34,7 +34,6 @@ namespace TriInspector.Drawers
|
|||||||
{
|
{
|
||||||
mode = Attribute.Mode,
|
mode = Attribute.Mode,
|
||||||
previewHeight = Attribute.PreviewHeight,
|
previewHeight = Attribute.PreviewHeight,
|
||||||
previewWidth = Attribute.PreviewWidth,
|
|
||||||
}));
|
}));
|
||||||
return element;
|
return element;
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,6 @@ namespace TriInspector.Elements
|
|||||||
public struct Props
|
public struct Props
|
||||||
{
|
{
|
||||||
public InlineEditorModes mode;
|
public InlineEditorModes mode;
|
||||||
public float previewWidth;
|
|
||||||
public float previewHeight;
|
public float previewHeight;
|
||||||
|
|
||||||
public bool DrawGUI => (mode & InlineEditorModes.GUIOnly) != 0;
|
public bool DrawGUI => (mode & InlineEditorModes.GUIOnly) != 0;
|
||||||
@ -95,7 +94,7 @@ namespace TriInspector.Elements
|
|||||||
if (_editor != null && shouldDrawEditor)
|
if (_editor != null && shouldDrawEditor)
|
||||||
{
|
{
|
||||||
GUILayout.BeginArea(_editorPosition);
|
GUILayout.BeginArea(_editorPosition);
|
||||||
GUILayout.BeginHorizontal();
|
GUILayout.BeginVertical();
|
||||||
|
|
||||||
if (_props.DrawHeader || _props.DrawGUI)
|
if (_props.DrawHeader || _props.DrawGUI)
|
||||||
{
|
{
|
||||||
@ -122,13 +121,8 @@ namespace TriInspector.Elements
|
|||||||
{
|
{
|
||||||
GUILayout.BeginVertical();
|
GUILayout.BeginVertical();
|
||||||
|
|
||||||
var horizontal = _props.DrawHeader || _props.DrawGUI;
|
var previewOpts = new[] {GUILayout.ExpandWidth(true), GUILayout.Height(_props.previewHeight),};
|
||||||
|
var previewRect = EditorGUILayout.GetControlRect(false, _props.previewHeight, previewOpts);
|
||||||
var previewOpts = horizontal
|
|
||||||
? new[] {GUILayout.Width(_props.previewWidth), GUILayout.ExpandHeight(true),}
|
|
||||||
: new[] {GUILayout.ExpandWidth(true), GUILayout.Height(_props.previewHeight),};
|
|
||||||
|
|
||||||
var previewRect = GUILayoutUtility.GetRect(GUIContent.none, GUIStyle.none, previewOpts);
|
|
||||||
|
|
||||||
previewRect.width = Mathf.Max(previewRect.width, 10);
|
previewRect.width = Mathf.Max(previewRect.width, 10);
|
||||||
previewRect.height = Mathf.Max(previewRect.height, 10);
|
previewRect.height = Mathf.Max(previewRect.height, 10);
|
||||||
@ -143,7 +137,7 @@ namespace TriInspector.Elements
|
|||||||
GUILayout.EndVertical();
|
GUILayout.EndVertical();
|
||||||
}
|
}
|
||||||
|
|
||||||
GUILayout.EndHorizontal();
|
GUILayout.EndVertical();
|
||||||
lastEditorRect = GUILayoutUtility.GetLastRect();
|
lastEditorRect = GUILayoutUtility.GetLastRect();
|
||||||
GUILayout.EndArea();
|
GUILayout.EndArea();
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,6 @@ namespace TriInspector
|
|||||||
{
|
{
|
||||||
public InlineEditorModes Mode { get; set; } = InlineEditorModes.GUIOnly;
|
public InlineEditorModes Mode { get; set; } = InlineEditorModes.GUIOnly;
|
||||||
|
|
||||||
public float PreviewWidth { get; set; } = 100;
|
|
||||||
public float PreviewHeight { get; set; } = 50;
|
public float PreviewHeight { get; set; } = 50;
|
||||||
|
|
||||||
public InlineEditorAttribute()
|
public InlineEditorAttribute()
|
||||||
|
Loading…
Reference in New Issue
Block a user