mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-06 13:08:47 +02:00
Nav: Added io.NavFlags to hold various options. Added ImGuiNavFlags_EnableGamepad and ImGuiNavFlags_EnableKeyboard for bindings to use (#787)
This commit is contained in:
@ -830,13 +830,13 @@ ImGuiIO::ImGuiIO()
|
||||
IniSavingRate = 5.0f;
|
||||
IniFilename = "imgui.ini";
|
||||
LogFilename = "imgui_log.txt";
|
||||
NavFlags = 0x00;
|
||||
MouseDoubleClickTime = 0.30f;
|
||||
MouseDoubleClickMaxDist = 6.0f;
|
||||
for (int i = 0; i < ImGuiKey_COUNT; i++)
|
||||
KeyMap[i] = -1;
|
||||
KeyRepeatDelay = 0.250f;
|
||||
KeyRepeatRate = 0.050f;
|
||||
NavMovesMouse = false;
|
||||
UserData = NULL;
|
||||
|
||||
Fonts = &GImDefaultFontAtlas;
|
||||
@ -2883,7 +2883,7 @@ static void ImGui::NavUpdate()
|
||||
if (g.NavMousePosDirty && g.NavIdIsAlive)
|
||||
{
|
||||
// Set mouse position given our knowledge of the nav widget position from last frame
|
||||
if (g.IO.NavMovesMouse)
|
||||
if (g.IO.NavFlags & ImGuiNavFlags_MoveMouse)
|
||||
{
|
||||
g.IO.MousePos = g.IO.MousePosPrev = NavCalcPreferredMousePos();
|
||||
g.IO.WantMoveMouse = true;
|
||||
@ -5643,7 +5643,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
||||
{
|
||||
ImVec2 ref_pos = (!g.NavDisableHighlight && g.NavDisableMouseHover) ? NavCalcPreferredMousePos() : g.IO.MousePos;
|
||||
ImRect rect_to_avoid;
|
||||
if (!g.NavDisableHighlight && g.NavDisableMouseHover && !g.IO.NavMovesMouse)
|
||||
if (!g.NavDisableHighlight && g.NavDisableMouseHover && !(g.IO.NavFlags & ImGuiNavFlags_MoveMouse))
|
||||
rect_to_avoid = ImRect(ref_pos.x - 16, ref_pos.y - 8, ref_pos.x + 16, ref_pos.y + 8);
|
||||
else
|
||||
rect_to_avoid = ImRect(ref_pos.x - 16, ref_pos.y - 8, ref_pos.x + 24, ref_pos.y + 24); // FIXME-NAV: Completely hard-coded based on expected mouse cursor size. Store boxes in mouse cursor data? Scale? Center on cursor hit-point?
|
||||
@ -7288,6 +7288,7 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool
|
||||
if (hovered && (flags & ImGuiButtonFlags_AllowItemOverlap) && (g.HoveredIdPreviousFrame != id && g.HoveredIdPreviousFrame != 0))
|
||||
hovered = false;
|
||||
|
||||
// Mouse
|
||||
if (hovered)
|
||||
{
|
||||
if (!(flags & ImGuiButtonFlags_NoKeyModifiers) || (!g.IO.KeyCtrl && !g.IO.KeyShift && !g.IO.KeyAlt))
|
||||
|
Reference in New Issue
Block a user