Browse Source

Remove manual left offseting in ReorderableList CommandListAdapter

master
desktop-maesty/steve 7 years ago
parent
commit
ff5c46195f
  1. 12
      Assets/Fungus/Scripts/Editor/CommandListAdaptor.cs

12
Assets/Fungus/Scripts/Editor/CommandListAdaptor.cs

@ -57,7 +57,7 @@ namespace Fungus.EditorUtils
private void DrawHeader(Rect rect) private void DrawHeader(Rect rect)
{ {
EditorGUI.PrefixLabel(rect, new GUIContent("Commands")); EditorGUI.LabelField(rect, new GUIContent("Commands"));
} }
public void DrawItem(Rect position, int index, bool selected, bool focused) public void DrawItem(Rect position, int index, bool selected, bool focused)
@ -136,7 +136,7 @@ namespace Fungus.EditorUtils
for (int i = 0; i < command.IndentLevel; ++i) for (int i = 0; i < command.IndentLevel; ++i)
{ {
Rect indentRect = position; Rect indentRect = position;
indentRect.x += i * indentSize - 21; indentRect.x += i * indentSize;// - 21;
indentRect.width = indentSize + 1; indentRect.width = indentSize + 1;
indentRect.y -= 2; indentRect.y -= 2;
indentRect.height += 5; indentRect.height += 5;
@ -148,9 +148,9 @@ namespace Fungus.EditorUtils
float indentWidth = command.IndentLevel * indentSize; float indentWidth = command.IndentLevel * indentSize;
Rect commandLabelRect = position; Rect commandLabelRect = position;
commandLabelRect.x += indentWidth - 21; commandLabelRect.x += indentWidth;// - 21;
commandLabelRect.y -= 2; commandLabelRect.y -= 2;
commandLabelRect.width -= (indentSize * command.IndentLevel - 22); commandLabelRect.width -= (indentSize * command.IndentLevel);// - 22);
commandLabelRect.height += 5; commandLabelRect.height += 5;
// There's a weird incompatibility between the Reorderable list control used for the command list and // There's a weird incompatibility between the Reorderable list control used for the command list and
@ -159,8 +159,8 @@ namespace Fungus.EditorUtils
// The workaround for now is to hide the reordering grabber from mouse clicks by extending the command // The workaround for now is to hide the reordering grabber from mouse clicks by extending the command
// selection rectangle to cover it. We are planning to totally replace the command list display system. // selection rectangle to cover it. We are planning to totally replace the command list display system.
Rect clickRect = position; Rect clickRect = position;
clickRect.x -= 20; //clickRect.x -= 20;
clickRect.width += 20; //clickRect.width += 20;
// Select command via left click // Select command via left click
if (Event.current.type == EventType.MouseDown && if (Event.current.type == EventType.MouseDown &&

Loading…
Cancel
Save