Browse Source

CommandListAdapter sync command selection bidirectionally with selection in underlying reorderablelist

master
desktop-maesty/steve 5 years ago
parent
commit
c1b0b10def
  1. 16
      Assets/Fungus/Scripts/Editor/CommandListAdaptor.cs

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

@ -83,12 +83,19 @@ namespace Fungus.EditorUtils
list.drawHeaderCallback = DrawHeader;
list.drawElementCallback = DrawItem;
//list.elementHeightCallback = GetElementHeight;
list.onSelectCallback = SelectChanged;
}
//private float GetElementHeight(int index)
//{
// return EditorGUI.GetPropertyHeight(this[index], null, true);// + EditorGUIUtility.singleLineHeight;
//}
private void SelectChanged(ReorderableList list)
{
Command command = this[list.index].objectReferenceValue as Command;
var flowchart = (Flowchart)command.GetFlowchart();
BlockEditor.actionList.Add(delegate
{
flowchart.ClearSelectedCommands();
flowchart.AddSelectedCommand(command);
});
}
private void DrawHeader(Rect rect)
{
@ -227,6 +234,7 @@ namespace Fungus.EditorUtils
flowchart.ClearSelectedCommands();
});
Event.current.Use();
list.index = index;
}
BlockEditor.actionList.Add(delegate

Loading…
Cancel
Save