Browse Source

Correct width calc on smaller width inspectors

Correctly calc index in command menu popup when list is being filtered or reordered by the flowchart.
master
desktop-maesty/steve 6 years ago
parent
commit
4e2231a92d
  1. 3
      Assets/Fungus/Scripts/Editor/BlockEditor.cs
  2. 7
      Assets/Fungus/Scripts/Editor/PopupContent/CommandSelectorPopupWindowContent.cs

3
Assets/Fungus/Scripts/Editor/BlockEditor.cs

@ -288,7 +288,8 @@ namespace Fungus.EditorUtils
GUILayout.FlexibleSpace();
var pos = EditorGUILayout.GetControlRect(true, 0, EditorStyles.objectField);
//using false to prevent forcing a longer row than will fit on smallest inspector
var pos = EditorGUILayout.GetControlRect(false, 0, EditorStyles.objectField);
if (pos.x != 0)
{
lastCMDpopupPos = pos;

7
Assets/Fungus/Scripts/Editor/PopupContent/CommandSelectorPopupWindowContent.cs

@ -48,12 +48,11 @@ namespace Fungus.EditorUtils
filteredAttributes = GetFilteredSupportedCommands(curBlock.GetFlowchart());
int i = 0;
foreach (var item in filteredAttributes)
{
allItems.Add(new FilteredListItem(i, (item.Value.Category.Length > 0 ? item.Value.Category + CATEGORY_CHAR : "") + item.Value.CommandName, item.Value.HelpText));
i++;
//force lookup to orig index here to account for commmand lists being filtered by users
var newFilteredItem = new FilteredListItem(commandTypes.IndexOf(item.Key), (item.Value.Category.Length > 0 ? item.Value.Category + CATEGORY_CHAR : "") + item.Value.CommandName, item.Value.HelpText);
allItems.Add(newFilteredItem);
}
}

Loading…
Cancel
Save