Browse Source

Made sure selected block is always on top

master
Zach Vinless 8 years ago
parent
commit
3f17ef564f
  1. 12
      Assets/Fungus/Scripts/Editor/FlowchartWindow.cs

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

@ -321,6 +321,8 @@ namespace Fungus.EditorUtils
protected virtual void OnGUI() protected virtual void OnGUI()
{ {
// TODO: avoid calling some of these methods in OnGUI because it should be possible
// to only call them when a flowchart is selected, etc.
flowchart = GetFlowchart(); flowchart = GetFlowchart();
if (flowchart == null) if (flowchart == null)
@ -333,6 +335,7 @@ namespace Fungus.EditorUtils
blocks = flowchart.GetComponents<Block>(); blocks = flowchart.GetComponents<Block>();
UpdateFilteredBlocks(); UpdateFilteredBlocks();
BringSelectedBlockToFront();
HandleEarlyEvents(Event.current); HandleEarlyEvents(Event.current);
@ -348,10 +351,12 @@ namespace Fungus.EditorUtils
DrawFlowchartView(); DrawFlowchartView();
// Draw selection box // Draw selection box
if (startSelectionBoxPosition.x >= 0 && startSelectionBoxPosition.y >= 0) if (Event.current.type == EventType.Repaint)
{ {
GUI.Box(selectionBox, "", GUI.skin.FindStyle("SelectionRect")); if (startSelectionBoxPosition.x >= 0 && startSelectionBoxPosition.y >= 0)
forceRepaintCount = 1; {
GUI.Box(selectionBox, "", GUI.skin.FindStyle("SelectionRect"));
}
} }
// Draw toolbar, search popup, and variables window // Draw toolbar, search popup, and variables window
@ -641,7 +646,6 @@ namespace Fungus.EditorUtils
dragBlock = hitBlock; dragBlock = hitBlock;
} }
BringSelectedBlockToFront();
e.Use(); e.Use();
GUIUtility.keyboardControl = 0; // Fix for textarea not refeshing (change focus) GUIUtility.keyboardControl = 0; // Fix for textarea not refeshing (change focus)
} }

Loading…
Cancel
Save