Browse Source

EventSelector correct width and configurable heigth

master
desktop-maesty/steve 7 years ago
parent
commit
233d72bd8c
  1. 2
      Assets/Fungus/Scripts/Editor/BlockEditor.cs
  2. 15
      Assets/Fungus/Scripts/Editor/EventSelectorPopupWindowContent.cs

2
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();

15
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<Type> eventHandlerTypes)
public EventSelectorPopupWindowContent(string currentHandlerName, Block block, List<Type> 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<Type> eventHandlerTypes)
static public void DoEventHandlerPopUp(Rect position, string currentHandlerName, Block block, List<Type> 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

Loading…
Cancel
Save