Browse Source

Removed flowchart min/max buttons and undid reflection null checks

-Removed redundant min/max buttons in flowchart toolbar
-Undid null checks from previous commit in favor of knowing about
problems versus potential dead code
master
Zach Vinless 8 years ago
parent
commit
79375f7055
  1. 33
      Assets/Fungus/Scripts/Editor/FlowchartWindow.cs

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

@ -95,24 +95,16 @@ namespace Fungus.EditorUtils
// The docked value doesn't always report correctly without the delayCall // The docked value doesn't always report correctly without the delayCall
EditorApplication.delayCall += () => { EditorApplication.delayCall += () => {
var flags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance; var flags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance;
var dockedProperty = typeof(EditorWindow).GetProperty("docked", flags); var isDockedMethod = typeof(EditorWindow).GetProperty("docked", flags).GetGetMethod(true);
if ((bool) isDockedMethod.Invoke(this, null))
if (dockedProperty != null)
{ {
var isDockedMethod = dockedProperty.GetGetMethod(true); EditorZoomArea.Offset = new Vector2(2.0f, 19.0f);
if (isDockedMethod != null) }
{ else
if ((bool) isDockedMethod.Invoke(this, null)) {
{ EditorZoomArea.Offset = new Vector2(0.0f, 22.0f);
EditorZoomArea.Offset = new Vector2(2.0f, 19.0f);
}
else
{
EditorZoomArea.Offset = new Vector2(0.0f, 22.0f);
}
}
} }
}; };
} }
public static Flowchart GetFlowchart() public static Flowchart GetFlowchart()
@ -205,15 +197,6 @@ namespace Fungus.EditorUtils
); );
GUILayout.Label(flowchart.Zoom.ToString("0.0#x"), EditorStyles.miniLabel, GUILayout.Width(30)); GUILayout.Label(flowchart.Zoom.ToString("0.0#x"), EditorStyles.miniLabel, GUILayout.Width(30));
if (GUILayout.Button("Min", EditorStyles.toolbarButton))
{
newZoom = minZoomValue;
}
if (GUILayout.Button("Max", EditorStyles.toolbarButton))
{
newZoom = maxZoomValue;
}
DoZoom(flowchart, newZoom - flowchart.Zoom, Vector2.one * 0.5f); DoZoom(flowchart, newZoom - flowchart.Zoom, Vector2.one * 0.5f);
if (GUILayout.Button("Center", EditorStyles.toolbarButton)) if (GUILayout.Button("Center", EditorStyles.toolbarButton))

Loading…
Cancel
Save