Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add standard vertical spacing to some drawers. #284

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public class InfoBoxDecoratorDrawer : DecoratorDrawer
{
public override float GetHeight()
{
return GetHelpBoxHeight();
return GetHelpBoxHeight() + EditorGUIUtility.standardVerticalSpacing;
}

public override void OnGUI(Rect rect)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,19 @@ public virtual float GetHelpBoxHeight()
return EditorGUIUtility.singleLineHeight * 2.0f;
}

protected virtual float GetHelpBoxPadding()
{
return EditorGUIUtility.standardVerticalSpacing;
}

public void DrawDefaultPropertyAndHelpBox(Rect rect, SerializedProperty property, string message, MessageType messageType)
{
float indentLength = NaughtyEditorGUI.GetIndentLength(rect);
Rect helpBoxRect = new Rect(
rect.x + indentLength,
rect.y,
rect.width - indentLength,
GetHelpBoxHeight());
GetHelpBoxHeight() - GetHelpBoxPadding());

NaughtyEditorGUI.HelpBox(helpBoxRect, message, MessageType.Warning, context: property.serializedObject.targetObject);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ protected override void OnGUI_Internal(Rect rect, SerializedProperty property, G

elementHeightCallback = (int index) =>
{
return EditorGUI.GetPropertyHeight(property.GetArrayElementAtIndex(index)) + 4.0f;
return EditorGUI.GetPropertyHeight(property.GetArrayElementAtIndex(index)) + EditorGUIUtility.standardVerticalSpacing;
}
};

Expand Down