Browse Source

Updated adding command

* Added the functionality so when a command is added, not only does it select it, it also scrolls to it. This is done pretty hackey, but it can work.
master
Michael Cox 3 years ago committed by Steve Halliwell
parent
commit
cdccb7cdff
  1. 11
      Assets/Fungus/Scripts/Editor/CommandListAdaptor.cs
  2. 6
      Assets/Fungus/Scripts/Editor/PopupContent/CommandSelectorPopupWindowContent.cs

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

@ -10,6 +10,12 @@ namespace Fungus.EditorUtils
{
public class CommandListAdaptor
{
/// <summary>
/// If true, scrolls to the currently selected command in the inspector when the editor is redrawn. A
/// Automatically resets to false.
/// </summary>
public static bool ScrollToCommandOnDraw = false;
public void DrawCommandList()
{
if (summaryStyle == null)
@ -159,6 +165,11 @@ namespace Fungus.EditorUtils
if (selectedCommand == command)
{
commandIsSelected = true;
if (ScrollToCommandOnDraw)
{
GUI.ScrollTo(position);
ScrollToCommandOnDraw = false;
}
break;
}
}

6
Assets/Fungus/Scripts/Editor/PopupContent/CommandSelectorPopupWindowContent.cs

@ -178,10 +178,10 @@ namespace Fungus.EditorUtils
//clear commands just in case there was a selection made prior,
// this way, only one command is selected at the end; the new one.
flowchart.ClearSelectedCommands();
flowchart.SelectedCommands.Add(newCommand); //select the new command.
flowchart.ClearSelectedCommands();
CommandListAdaptor.ScrollToCommandOnDraw = true;
flowchart.AddSelectedCommand(newCommand); //select the new command.
}
}
}

Loading…
Cancel
Save