Merge pull request #49 from JohannesDeml/bugfix/avoid-label-overlap
Fix label overlapping button
This commit is contained in:
commit
69830f3583
@ -35,12 +35,14 @@ namespace MackySoft.SerializeReferenceExtensions.Editor
|
|||||||
EditorGUI.BeginProperty(position,label,property);
|
EditorGUI.BeginProperty(position,label,property);
|
||||||
|
|
||||||
if (property.propertyType == SerializedPropertyType.ManagedReference) {
|
if (property.propertyType == SerializedPropertyType.ManagedReference) {
|
||||||
// Draw the subclass selector popup.
|
|
||||||
Rect popupPosition = new Rect(position);
|
|
||||||
popupPosition.width -= EditorGUIUtility.labelWidth;
|
|
||||||
popupPosition.x += EditorGUIUtility.labelWidth;
|
|
||||||
popupPosition.height = EditorGUIUtility.singleLineHeight;
|
|
||||||
|
|
||||||
|
// render label first to avoid label overlap for lists
|
||||||
|
Rect foldoutLabelRect = new Rect(position);
|
||||||
|
foldoutLabelRect.height = EditorGUIUtility.singleLineHeight;
|
||||||
|
foldoutLabelRect.x += EditorGUI.indentLevel * 12;
|
||||||
|
Rect popupPosition = EditorGUI.PrefixLabel(foldoutLabelRect, label);
|
||||||
|
|
||||||
|
// Draw the subclass selector popup.
|
||||||
if (EditorGUI.DropdownButton(popupPosition,GetTypeName(property),FocusType.Keyboard)) {
|
if (EditorGUI.DropdownButton(popupPosition,GetTypeName(property),FocusType.Keyboard)) {
|
||||||
TypePopupCache popup = GetTypePopup(property);
|
TypePopupCache popup = GetTypePopup(property);
|
||||||
m_TargetProperty = property;
|
m_TargetProperty = property;
|
||||||
@ -54,7 +56,7 @@ namespace MackySoft.SerializeReferenceExtensions.Editor
|
|||||||
// Draw the property with custom property drawer.
|
// Draw the property with custom property drawer.
|
||||||
Rect foldoutRect = new Rect(position);
|
Rect foldoutRect = new Rect(position);
|
||||||
foldoutRect.height = EditorGUIUtility.singleLineHeight;
|
foldoutRect.height = EditorGUIUtility.singleLineHeight;
|
||||||
property.isExpanded = EditorGUI.Foldout(foldoutRect, property.isExpanded, label, true);
|
property.isExpanded = EditorGUI.Foldout(foldoutRect, property.isExpanded, GUIContent.none, true);
|
||||||
|
|
||||||
if (property.isExpanded)
|
if (property.isExpanded)
|
||||||
{
|
{
|
||||||
@ -70,7 +72,7 @@ namespace MackySoft.SerializeReferenceExtensions.Editor
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
EditorGUI.PropertyField(position, property, label, true);
|
EditorGUI.PropertyField(position, property, GUIContent.none, true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
EditorGUI.LabelField(position,label,k_IsNotManagedReferenceLabel);
|
EditorGUI.LabelField(position,label,k_IsNotManagedReferenceLabel);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user