mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +00:00
Internals: Tracking dummy select scope id (currently always zero) to facilitate merging of the range_select branch. (#1861)
This commit is contained in:
parent
d5945aa25b
commit
5cb7040f66
@ -7321,6 +7321,7 @@ static void ImGui::NavProcessItem(ImGuiWindow* window, const ImRect& nav_bb, con
|
|||||||
if (new_best)
|
if (new_best)
|
||||||
{
|
{
|
||||||
result->ID = id;
|
result->ID = id;
|
||||||
|
result->SelectScopeId = g.MultiSelectScopeId;
|
||||||
result->Window = window;
|
result->Window = window;
|
||||||
result->RectRel = nav_bb_rel;
|
result->RectRel = nav_bb_rel;
|
||||||
}
|
}
|
||||||
@ -7332,6 +7333,7 @@ static void ImGui::NavProcessItem(ImGuiWindow* window, const ImRect& nav_bb, con
|
|||||||
{
|
{
|
||||||
result = &g.NavMoveResultLocalVisibleSet;
|
result = &g.NavMoveResultLocalVisibleSet;
|
||||||
result->ID = id;
|
result->ID = id;
|
||||||
|
result->SelectScopeId = g.MultiSelectScopeId;
|
||||||
result->Window = window;
|
result->Window = window;
|
||||||
result->RectRel = nav_bb_rel;
|
result->RectRel = nav_bb_rel;
|
||||||
}
|
}
|
||||||
@ -7872,8 +7874,13 @@ static void ImGui::NavUpdateMoveResult()
|
|||||||
|
|
||||||
ClearActiveID();
|
ClearActiveID();
|
||||||
g.NavWindow = result->Window;
|
g.NavWindow = result->Window;
|
||||||
|
if (g.NavId != result->ID)
|
||||||
|
{
|
||||||
|
// Don't set NavJustMovedToId if just landed on the same spot (which may happen with ImGuiNavMoveFlags_AllowCurrentNavId)
|
||||||
|
g.NavJustMovedToId = result->ID;
|
||||||
|
g.NavJustMovedToSelectScopeId = result->SelectScopeId;
|
||||||
|
}
|
||||||
SetNavIDWithRectRel(result->ID, g.NavLayer, result->RectRel);
|
SetNavIDWithRectRel(result->ID, g.NavLayer, result->RectRel);
|
||||||
g.NavJustMovedToId = result->ID;
|
|
||||||
g.NavMoveFromClampedRefRect = false;
|
g.NavMoveFromClampedRefRect = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -691,6 +691,7 @@ struct ImDrawDataBuilder
|
|||||||
struct ImGuiNavMoveResult
|
struct ImGuiNavMoveResult
|
||||||
{
|
{
|
||||||
ImGuiID ID; // Best candidate
|
ImGuiID ID; // Best candidate
|
||||||
|
ImGuiID SelectScopeId;// Best candidate window current selectable group ID
|
||||||
ImGuiWindow* Window; // Best candidate window
|
ImGuiWindow* Window; // Best candidate window
|
||||||
float DistBox; // Best candidate box distance to current NavId
|
float DistBox; // Best candidate box distance to current NavId
|
||||||
float DistCenter; // Best candidate center distance to current NavId
|
float DistCenter; // Best candidate center distance to current NavId
|
||||||
@ -698,7 +699,7 @@ struct ImGuiNavMoveResult
|
|||||||
ImRect RectRel; // Best candidate bounding box in window relative space
|
ImRect RectRel; // Best candidate bounding box in window relative space
|
||||||
|
|
||||||
ImGuiNavMoveResult() { Clear(); }
|
ImGuiNavMoveResult() { Clear(); }
|
||||||
void Clear() { ID = 0; Window = NULL; DistBox = DistCenter = DistAxial = FLT_MAX; RectRel = ImRect(); }
|
void Clear() { ID = SelectScopeId = 0; Window = NULL; DistBox = DistCenter = DistAxial = FLT_MAX; RectRel = ImRect(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
// Storage for SetNexWindow** functions
|
// Storage for SetNexWindow** functions
|
||||||
@ -823,8 +824,9 @@ struct ImGuiContext
|
|||||||
ImGuiID NavActivatePressedId; // ~~ IsNavInputPressed(ImGuiNavInput_Activate) ? NavId : 0
|
ImGuiID NavActivatePressedId; // ~~ IsNavInputPressed(ImGuiNavInput_Activate) ? NavId : 0
|
||||||
ImGuiID NavInputId; // ~~ IsNavInputPressed(ImGuiNavInput_Input) ? NavId : 0
|
ImGuiID NavInputId; // ~~ IsNavInputPressed(ImGuiNavInput_Input) ? NavId : 0
|
||||||
ImGuiID NavJustTabbedId; // Just tabbed to this id.
|
ImGuiID NavJustTabbedId; // Just tabbed to this id.
|
||||||
ImGuiID NavJustMovedToId; // Just navigated to this id (result of a successfully MoveRequest)
|
ImGuiID NavJustMovedToId; // Just navigated to this id (result of a successfully MoveRequest).
|
||||||
ImGuiID NavNextActivateId; // Set by ActivateItem(), queued until next frame
|
ImGuiID NavJustMovedToSelectScopeId; // Just navigated to this select scope id (result of a successfully MoveRequest).
|
||||||
|
ImGuiID NavNextActivateId; // Set by ActivateItem(), queued until next frame.
|
||||||
ImGuiInputSource NavInputSource; // Keyboard or Gamepad mode? THIS WILL ONLY BE None or NavGamepad or NavKeyboard.
|
ImGuiInputSource NavInputSource; // Keyboard or Gamepad mode? THIS WILL ONLY BE None or NavGamepad or NavKeyboard.
|
||||||
ImRect NavScoringRectScreen; // Rectangle used for scoring, in screen space. Based of window->DC.NavRefRectRel[], modified for directional navigation scoring.
|
ImRect NavScoringRectScreen; // Rectangle used for scoring, in screen space. Based of window->DC.NavRefRectRel[], modified for directional navigation scoring.
|
||||||
int NavScoringCount; // Metrics for debugging
|
int NavScoringCount; // Metrics for debugging
|
||||||
@ -897,6 +899,10 @@ struct ImGuiContext
|
|||||||
int TooltipOverrideCount;
|
int TooltipOverrideCount;
|
||||||
ImVector<char> PrivateClipboard; // If no custom clipboard handler is defined
|
ImVector<char> PrivateClipboard; // If no custom clipboard handler is defined
|
||||||
|
|
||||||
|
// Range-Select/Multi-Select
|
||||||
|
// [This is unused in this branch, but left here to facilitate merging/syncing multiple branches]
|
||||||
|
ImGuiID MultiSelectScopeId;
|
||||||
|
|
||||||
// Platform support
|
// Platform support
|
||||||
ImVec2 PlatformImePos; // Cursor position request & last passed to the OS Input Method Editor
|
ImVec2 PlatformImePos; // Cursor position request & last passed to the OS Input Method Editor
|
||||||
ImVec2 PlatformImeLastPos;
|
ImVec2 PlatformImeLastPos;
|
||||||
@ -968,7 +974,7 @@ struct ImGuiContext
|
|||||||
|
|
||||||
NavWindow = NULL;
|
NavWindow = NULL;
|
||||||
NavId = NavActivateId = NavActivateDownId = NavActivatePressedId = NavInputId = 0;
|
NavId = NavActivateId = NavActivateDownId = NavActivatePressedId = NavInputId = 0;
|
||||||
NavJustTabbedId = NavJustMovedToId = NavNextActivateId = 0;
|
NavJustTabbedId = NavJustMovedToId = NavJustMovedToSelectScopeId = NavNextActivateId = 0;
|
||||||
NavInputSource = ImGuiInputSource_None;
|
NavInputSource = ImGuiInputSource_None;
|
||||||
NavScoringRectScreen = ImRect();
|
NavScoringRectScreen = ImRect();
|
||||||
NavScoringCount = 0;
|
NavScoringCount = 0;
|
||||||
@ -1014,6 +1020,9 @@ struct ImGuiContext
|
|||||||
DragSpeedDefaultRatio = 1.0f / 100.0f;
|
DragSpeedDefaultRatio = 1.0f / 100.0f;
|
||||||
ScrollbarClickDeltaToGrabCenter = ImVec2(0.0f, 0.0f);
|
ScrollbarClickDeltaToGrabCenter = ImVec2(0.0f, 0.0f);
|
||||||
TooltipOverrideCount = 0;
|
TooltipOverrideCount = 0;
|
||||||
|
|
||||||
|
MultiSelectScopeId = 0;
|
||||||
|
|
||||||
PlatformImePos = PlatformImeLastPos = ImVec2(FLT_MAX, FLT_MAX);
|
PlatformImePos = PlatformImeLastPos = ImVec2(FLT_MAX, FLT_MAX);
|
||||||
|
|
||||||
SettingsLoaded = false;
|
SettingsLoaded = false;
|
||||||
@ -1352,7 +1361,7 @@ namespace ImGui
|
|||||||
IMGUI_API bool ItemAdd(const ImRect& bb, ImGuiID id, const ImRect* nav_bb = NULL);
|
IMGUI_API bool ItemAdd(const ImRect& bb, ImGuiID id, const ImRect* nav_bb = NULL);
|
||||||
IMGUI_API bool ItemHoverable(const ImRect& bb, ImGuiID id);
|
IMGUI_API bool ItemHoverable(const ImRect& bb, ImGuiID id);
|
||||||
IMGUI_API bool IsClippedEx(const ImRect& bb, ImGuiID id, bool clip_even_when_logged);
|
IMGUI_API bool IsClippedEx(const ImRect& bb, ImGuiID id, bool clip_even_when_logged);
|
||||||
IMGUI_API bool FocusableItemRegister(ImGuiWindow* window, ImGuiID id, bool tab_stop = true); // Return true if focus is requested
|
IMGUI_API bool FocusableItemRegister(ImGuiWindow* window, ImGuiID id, bool tab_stop = true); // Return true if focus is requested
|
||||||
IMGUI_API void FocusableItemUnregister(ImGuiWindow* window);
|
IMGUI_API void FocusableItemUnregister(ImGuiWindow* window);
|
||||||
IMGUI_API ImVec2 CalcItemSize(ImVec2 size, float default_x, float default_y);
|
IMGUI_API ImVec2 CalcItemSize(ImVec2 size, float default_x, float default_y);
|
||||||
IMGUI_API float CalcWrapWidthForPos(const ImVec2& pos, float wrap_pos_x);
|
IMGUI_API float CalcWrapWidthForPos(const ImVec2& pos, float wrap_pos_x);
|
||||||
|
Loading…
Reference in New Issue
Block a user