diff --git a/Assets/Fungus/Scripts/Editor/BlockEditor.cs b/Assets/Fungus/Scripts/Editor/BlockEditor.cs index 2fa6266c..d739301d 100644 --- a/Assets/Fungus/Scripts/Editor/BlockEditor.cs +++ b/Assets/Fungus/Scripts/Editor/BlockEditor.cs @@ -474,7 +474,7 @@ namespace Fungus.EditorUtils EditorGUILayout.PrefixLabel(new GUIContent("Execute On Event")); if (EditorGUILayout.DropdownButton(new GUIContent(currentHandlerName),FocusType.Passive)) { - EventSelectorPopupWindowContent.DoEventHandlerPopUp(lastEventPopupPos, currentHandlerName, block, eventHandlerTypes); + EventSelectorPopupWindowContent.DoEventHandlerPopUp(lastEventPopupPos, currentHandlerName, block, eventHandlerTypes, (int)(EditorGUIUtility.currentViewWidth - lastEventPopupPos.x), 200); } EditorGUILayout.EndHorizontal(); diff --git a/Assets/Fungus/Scripts/Editor/EventSelectorPopupWindowContent.cs b/Assets/Fungus/Scripts/Editor/EventSelectorPopupWindowContent.cs index a09b474c..db7b4345 100644 --- a/Assets/Fungus/Scripts/Editor/EventSelectorPopupWindowContent.cs +++ b/Assets/Fungus/Scripts/Editor/EventSelectorPopupWindowContent.cs @@ -49,14 +49,16 @@ namespace Fungus.EditorUtils private int scrollToIndex; private float scrollOffset; private int currentIndex; + private Vector2 size; static readonly char[] SEARCH_SPLITS = new char[]{ '/', ' ' }; - public EventSelectorPopupWindowContent(string currentHandlerName, Block block, List eventHandlerTypes) + public EventSelectorPopupWindowContent(string currentHandlerName, Block block, List eventHandlerTypes, int width, int height) { this.currentHandlerName = currentHandlerName; this.block = block; this.eventHandlerTypes = eventHandlerTypes; + this.size = new Vector2(width, height); int i = 0; foreach (System.Type type in eventHandlerTypes) @@ -87,6 +89,11 @@ namespace Fungus.EditorUtils DrawSelectionArea(scrollRect); } + public override Vector2 GetWindowSize() + { + return size; + } + private void DrawSearch(Rect rect) { if (Event.current.type == EventType.Repaint) @@ -242,11 +249,11 @@ namespace Fungus.EditorUtils } } - static public void DoEventHandlerPopUp(Rect rect, string currentHandlerName, Block block, List eventHandlerTypes) + static public void DoEventHandlerPopUp(Rect position, string currentHandlerName, Block block, List eventHandlerTypes, int width, int height) { //new method - EventSelectorPopupWindowContent win = new EventSelectorPopupWindowContent(currentHandlerName, block, eventHandlerTypes); - PopupWindow.Show(rect, win); + EventSelectorPopupWindowContent win = new EventSelectorPopupWindowContent(currentHandlerName, block, eventHandlerTypes, width, height); + PopupWindow.Show(position, win); //old method