Nav, Demo: comments.
This commit is contained in:
parent
669021be4c
commit
74a1854db9
@ -1096,7 +1096,7 @@ CODE
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Debug options
|
// Debug options
|
||||||
#define IMGUI_DEBUG_NAV_SCORING 0 // Display navigation scoring preview when hovering items. Display last moving direction matches when holding CTRL
|
#define IMGUI_DEBUG_NAV_SCORING 0 // Display navigation scoring preview when hovering items. Hold CTRL to display for all candidates. CTRL+Arrow to change last direction.
|
||||||
#define IMGUI_DEBUG_NAV_RECTS 0 // Display the reference navigation rectangle for each window
|
#define IMGUI_DEBUG_NAV_RECTS 0 // Display the reference navigation rectangle for each window
|
||||||
|
|
||||||
// When using CTRL+TAB (or Gamepad Square+L/R) we delay the visual a little in order to reduce visual noise doing a fast switch.
|
// When using CTRL+TAB (or Gamepad Square+L/R) we delay the visual a little in order to reduce visual noise doing a fast switch.
|
||||||
@ -11716,6 +11716,9 @@ static bool ImGui::NavScoreItem(ImGuiNavItemData* result)
|
|||||||
if (dbx != 0.0f || dby != 0.0f)
|
if (dbx != 0.0f || dby != 0.0f)
|
||||||
{
|
{
|
||||||
// For non-overlapping boxes, use distance between boxes
|
// For non-overlapping boxes, use distance between boxes
|
||||||
|
// FIXME-NAV: Quadrant may be incorrect because of (1) dbx bias and (2) curr.Max.y bias applied by NavBiasScoringRect() where typically curr.Max.y==curr.Min.y
|
||||||
|
// One typical case where this happens, with style.WindowMenuButtonPosition == ImGuiDir_Right, pressing Left to navigate from Close to Collapse tends to fail.
|
||||||
|
// Also see #6344. Calling ImGetDirQuadrantFromDelta() with unbiased values may be good but side-effects are plenty.
|
||||||
dax = dbx;
|
dax = dbx;
|
||||||
day = dby;
|
day = dby;
|
||||||
dist_axial = dist_box;
|
dist_axial = dist_box;
|
||||||
|
@ -7793,6 +7793,7 @@ static ExampleTreeNode* ExampleTree_CreateNode(const char* name, const ImGuiID u
|
|||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Create example tree data
|
||||||
static ExampleTreeNode* ExampleTree_CreateDemoTree()
|
static ExampleTreeNode* ExampleTree_CreateDemoTree()
|
||||||
{
|
{
|
||||||
static const char* root_names[] = { "Apple", "Banana", "Cherry", "Kiwi", "Mango", "Orange", "Pineapple", "Strawberry", "Watermelon" };
|
static const char* root_names[] = { "Apple", "Banana", "Cherry", "Kiwi", "Mango", "Orange", "Pineapple", "Strawberry", "Watermelon" };
|
||||||
@ -7826,6 +7827,7 @@ static ExampleTreeNode* ExampleTree_CreateDemoTree()
|
|||||||
// Some of the interactions are a bit lack-luster:
|
// Some of the interactions are a bit lack-luster:
|
||||||
// - We would want the table scrolling window to use NavFlattened.
|
// - We would want the table scrolling window to use NavFlattened.
|
||||||
// - We would want pressing validating or leaving the filter to somehow restore focus.
|
// - We would want pressing validating or leaving the filter to somehow restore focus.
|
||||||
|
// - We may want more advanced filtering (child nodes) and clipper support: both will need extra work.
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
struct ExampleAppPropertyEditor
|
struct ExampleAppPropertyEditor
|
||||||
@ -7835,13 +7837,12 @@ struct ExampleAppPropertyEditor
|
|||||||
void Draw(ExampleTreeNode* root_node)
|
void Draw(ExampleTreeNode* root_node)
|
||||||
{
|
{
|
||||||
ImGui::SetNextItemWidth(-FLT_MIN);
|
ImGui::SetNextItemWidth(-FLT_MIN);
|
||||||
ImGui::SetNextItemShortcut(ImGuiMod_Ctrl | ImGuiKey_F);
|
ImGui::SetNextItemShortcut(ImGuiMod_Ctrl | ImGuiKey_F, ImGuiInputFlags_Tooltip);
|
||||||
ImGui::PushItemFlag(ImGuiItemFlags_NoNavDefaultFocus, true);
|
ImGui::PushItemFlag(ImGuiItemFlags_NoNavDefaultFocus, true);
|
||||||
if (ImGui::InputTextWithHint("##Filter", "incl,-excl", Filter.InputBuf, IM_ARRAYSIZE(Filter.InputBuf), ImGuiInputTextFlags_EscapeClearsAll))
|
if (ImGui::InputTextWithHint("##Filter", "incl,-excl", Filter.InputBuf, IM_ARRAYSIZE(Filter.InputBuf), ImGuiInputTextFlags_EscapeClearsAll))
|
||||||
Filter.Build();
|
Filter.Build();
|
||||||
ImGui::PopItemFlag();
|
ImGui::PopItemFlag();
|
||||||
|
|
||||||
//ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(2, 2));
|
|
||||||
ImGuiTableFlags table_flags = ImGuiTableFlags_Resizable | ImGuiTableFlags_ScrollY | ImGuiTableFlags_RowBg;
|
ImGuiTableFlags table_flags = ImGuiTableFlags_Resizable | ImGuiTableFlags_ScrollY | ImGuiTableFlags_RowBg;
|
||||||
if (ImGui::BeginTable("##split", 2, table_flags))
|
if (ImGui::BeginTable("##split", 2, table_flags))
|
||||||
{
|
{
|
||||||
@ -7850,13 +7851,11 @@ struct ExampleAppPropertyEditor
|
|||||||
//ImGui::TableSetupScrollFreeze(0, 1);
|
//ImGui::TableSetupScrollFreeze(0, 1);
|
||||||
//ImGui::TableHeadersRow();
|
//ImGui::TableHeadersRow();
|
||||||
|
|
||||||
// Filter root node
|
|
||||||
for (ExampleTreeNode* node : root_node->Childs)
|
for (ExampleTreeNode* node : root_node->Childs)
|
||||||
if (Filter.PassFilter(node->Name))
|
if (Filter.PassFilter(node->Name)) // Filter root node
|
||||||
DrawTreeNode(node);
|
DrawTreeNode(node);
|
||||||
ImGui::EndTable();
|
ImGui::EndTable();
|
||||||
}
|
}
|
||||||
//ImGui::PopStyleVar();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawTreeNode(ExampleTreeNode* node)
|
void DrawTreeNode(ExampleTreeNode* node)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user