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.drawHeaderCallback = DrawHeader;
list.drawElementCallback = DrawItem; list.drawElementCallback = DrawItem;
//list.elementHeightCallback = GetElementHeight; //list.elementHeightCallback = GetElementHeight;
list.onSelectCallback = SelectChanged;
} }
//private float GetElementHeight(int index) private void SelectChanged(ReorderableList list)
//{ {
// return EditorGUI.GetPropertyHeight(this[index], null, true);// + EditorGUIUtility.singleLineHeight; 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) private void DrawHeader(Rect rect)
{ {
@ -227,6 +234,7 @@ namespace Fungus.EditorUtils
flowchart.ClearSelectedCommands(); flowchart.ClearSelectedCommands();
}); });
Event.current.Use(); Event.current.Use();
list.index = index;
} }
BlockEditor.actionList.Add(delegate BlockEditor.actionList.Add(delegate

Loading…
Cancel
Save