|
|
@ -26,6 +26,7 @@ namespace Fungus |
|
|
|
protected Vector2 blockScrollPos; |
|
|
|
protected Vector2 blockScrollPos; |
|
|
|
protected Vector2 commandScrollPos; |
|
|
|
protected Vector2 commandScrollPos; |
|
|
|
protected bool resize = false; |
|
|
|
protected bool resize = false; |
|
|
|
|
|
|
|
protected bool clamp = false; |
|
|
|
protected float topPanelHeight = 50; |
|
|
|
protected float topPanelHeight = 50; |
|
|
|
|
|
|
|
|
|
|
|
// Cache the block and command editors so we only create and destroy them |
|
|
|
// Cache the block and command editors so we only create and destroy them |
|
|
@ -189,11 +190,7 @@ namespace Fungus |
|
|
|
flowchart.blockViewHeight = Event.current.mousePosition.y; |
|
|
|
flowchart.blockViewHeight = Event.current.mousePosition.y; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Make sure block view is always visible |
|
|
|
ClampBlockViewHeight(flowchart); |
|
|
|
float height = flowchart.blockViewHeight; |
|
|
|
|
|
|
|
height = Mathf.Max(200, height); |
|
|
|
|
|
|
|
height = Mathf.Min(Screen.height - 200,height); |
|
|
|
|
|
|
|
flowchart.blockViewHeight = height; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Stop resizing if mouse is outside inspector window. |
|
|
|
// Stop resizing if mouse is outside inspector window. |
|
|
|
// This isn't standard Unity UI behavior but it is robust and safe. |
|
|
|
// This isn't standard Unity UI behavior but it is robust and safe. |
|
|
@ -211,6 +208,31 @@ namespace Fungus |
|
|
|
resize = false; |
|
|
|
resize = false; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected virtual void ClampBlockViewHeight(Flowchart flowchart) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// Screen.height seems to temporarily reset to 480 for a single frame whenever a command like |
|
|
|
|
|
|
|
// Copy, Paste, etc. happens. Only clamp the block view height when one of these operations is not occuring. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (Event.current.commandName != "") |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
clamp = false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (clamp) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// Make sure block view is always clamped to visible area |
|
|
|
|
|
|
|
float height = flowchart.blockViewHeight; |
|
|
|
|
|
|
|
height = Mathf.Max(200, height); |
|
|
|
|
|
|
|
height = Mathf.Min(Screen.height - 200,height); |
|
|
|
|
|
|
|
flowchart.blockViewHeight = height; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (Event.current.type == EventType.Repaint) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
clamp = true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|