1.5.0: Added interface and utility class for adding settings to toolbar settings provider
This commit is contained in:
parent
12de62dabb
commit
91c9504910
25 changed files with 272 additions and 133 deletions
|
|
@ -52,6 +52,8 @@ namespace Module.NavigationTool.Editor.Toolbar
|
|||
private static void OnUpdateElements(VisualElement leftAlign, VisualElement rightAlign)
|
||||
{
|
||||
const float HEIGHT = 22.0f;
|
||||
const float ADD_CATEGORY = 2.0f;
|
||||
|
||||
var added = false;
|
||||
|
||||
for (int i = DRAWERS.Length - 1; i >= 0; i--)
|
||||
|
|
@ -61,18 +63,22 @@ namespace Module.NavigationTool.Editor.Toolbar
|
|||
|
||||
if (drawer.Visible && !valid)
|
||||
{
|
||||
var rect = new Rect(2.0f, 0.0f, drawer.CalculateWidth(), HEIGHT);
|
||||
var rect = new Rect(ADD_CATEGORY, 0.0f, drawer.CalculateWidth(), HEIGHT);
|
||||
drawer.Setup(rect);
|
||||
|
||||
var container = new ToolbarIMGUIContainer(drawer.OnGUI, drawer.Priority);
|
||||
container.style.width = rect.width + 4.0f;
|
||||
DICT_MAPPING.Add(drawer, container);
|
||||
added = true;
|
||||
var container = new ToolbarIMGUIContainer(drawer.OnGUI, drawer.Priority);
|
||||
|
||||
VisualElement parent;
|
||||
|
||||
if (drawer.Placement == EToolbarPlacement.Left)
|
||||
leftAlign.Add(container);
|
||||
parent = leftAlign;
|
||||
else
|
||||
rightAlign.Add(container);
|
||||
parent = rightAlign;
|
||||
|
||||
container.style.width = rect.width + ADD_CATEGORY * 2.0f;
|
||||
DICT_MAPPING.Add(drawer, container);
|
||||
|
||||
added = true;
|
||||
parent.Add(container);
|
||||
}
|
||||
else if (!drawer.Visible && valid)
|
||||
{
|
||||
|
|
@ -115,7 +121,7 @@ namespace Module.NavigationTool.Editor.Toolbar
|
|||
return -1;
|
||||
if (c1 == null)
|
||||
return 1;
|
||||
|
||||
|
||||
return c0.Priority.CompareTo(c1.Priority);
|
||||
}
|
||||
#else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue