Skip to content
Open
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 @@ -23,35 +23,44 @@ protected override void OnGUI_Internal(Rect rect, SerializedProperty property, G
{
EditorGUI.BeginProperty(rect, label, property);

float indentLength = NaughtyEditorGUI.GetIndentLength(rect);
bool wideMode = EditorGUIUtility.wideMode;

float labelWidth = EditorGUIUtility.labelWidth + NaughtyEditorGUI.HorizontalSpacing;
float lineHeight = EditorGUIUtility.singleLineHeight;
float indentLength = NaughtyEditorGUI.GetIndentLength(rect);
float xOffset = ((!wideMode)? 0 : labelWidth) - indentLength;
float yOffset = (wideMode)? 0 : lineHeight;
float floatFieldWidth = EditorGUIUtility.fieldWidth;
float sliderWidth = rect.width - labelWidth - 2.0f * floatFieldWidth;
float sliderWidth = rect.width - ((!wideMode)? 0 : labelWidth) - 2.0f * floatFieldWidth;
float sliderPadding = 5.0f;



Rect labelRect = new Rect(
rect.x,
rect.y,
labelWidth,
rect.height);
lineHeight);

Rect sliderRect = new Rect(
rect.x + labelWidth + floatFieldWidth + sliderPadding - indentLength,
rect.y,
sliderWidth - 2.0f * sliderPadding + indentLength,
rect.height);

Rect minFloatFieldRect = new Rect(
rect.x + labelWidth - indentLength,
rect.y,
rect.x + xOffset,
rect.y + yOffset,
floatFieldWidth + indentLength,
rect.height);
lineHeight);

Rect sliderRect = new Rect(
rect.x + xOffset + floatFieldWidth + sliderPadding,
rect.y + yOffset,
sliderWidth - 2.0f * sliderPadding + indentLength,
lineHeight);

Rect maxFloatFieldRect = new Rect(
rect.x + labelWidth + floatFieldWidth + sliderWidth - indentLength,
rect.y,
rect.x + xOffset + floatFieldWidth + sliderWidth,
rect.y + yOffset,
floatFieldWidth + indentLength,
rect.height);
lineHeight);


// Draw the label
EditorGUI.LabelField(labelRect, label.text);
Expand Down Expand Up @@ -105,4 +114,4 @@ protected override void OnGUI_Internal(Rect rect, SerializedProperty property, G
EditorGUI.EndProperty();
}
}
}
}