protected float GetReorderableElementHeight(int index) { float keyHeight = EditorGUI.GetPropertyHeight(KeysProperty.GetArrayElementAtIndex(index)); float valueHeight = EditorGUI.GetPropertyHeight(ValuesProperty.GetArrayElementAtIndex(index)); float height = 8 + Math.Max(keyHeight, valueHeight); if (!IsDragging || (IsDragging && elementHeight < height)) { elementHeight = height; } return(elementHeight); }
protected virtual void DrawElement(Rect rect, int index, bool isActive, bool isFocused) { rect.position = new Vector2(rect.position.x + 10, rect.position.y); SerializedProperty key = KeysProperty.GetArrayElementAtIndex(index); SerializedProperty value = ValuesProperty.GetArrayElementAtIndex(index); float halfSizeX = rect.size.x / 2; float leftOffset = 100; float rightOffset = 58; Vector2 sizeKey = new Vector2(halfSizeX - leftOffset, rect.size.y); Vector2 sizeValue = new Vector2(halfSizeX + rightOffset, rect.size.y); Vector2 positionValue = rect.position + new Vector2(sizeKey.x + 25, 0); float oldWidth = EditorGUIUtility.labelWidth; EditorGUIUtility.labelWidth = 50; OnBeforeDrawProperties(); rect = DrawPropertiesForElement(new Rect(rect.position, sizeKey), new Rect(positionValue, sizeValue), key, value); OnAfterDrawProperties(); EditorGUIUtility.labelWidth = oldWidth; CheckRedBoxForElement(rect, key, index); }