mirror of
				https://github.com/ocornut/imgui.git
				synced 2025-11-04 01:34:32 +00:00 
			
		
		
		
	Nav: shallow tidying up.
This commit is contained in:
		@@ -4443,9 +4443,9 @@ bool ImGui::IsItemHovered(ImGuiHoveredFlags flags)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    if (g.NavDisableMouseHover && !g.NavDisableHighlight && !(flags & ImGuiHoveredFlags_NoNavOverride))
 | 
					    if (g.NavDisableMouseHover && !g.NavDisableHighlight && !(flags & ImGuiHoveredFlags_NoNavOverride))
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        if ((g.LastItemData.InFlags & ImGuiItemFlags_Disabled) && !(flags & ImGuiHoveredFlags_AllowWhenDisabled))
 | 
					        if (g.LastItemData.ID == g.NavId && g.NavId != 0) // IsItemFocused()
 | 
				
			||||||
            return false;
 | 
					            return false;
 | 
				
			||||||
        if (!IsItemFocused())
 | 
					        if ((g.LastItemData.InFlags & ImGuiItemFlags_Disabled) && !(flags & ImGuiHoveredFlags_AllowWhenDisabled))
 | 
				
			||||||
            return false;
 | 
					            return false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (flags & ImGuiHoveredFlags_ForTooltip)
 | 
					        if (flags & ImGuiHoveredFlags_ForTooltip)
 | 
				
			||||||
@@ -5784,9 +5784,7 @@ bool ImGui::IsItemDeactivatedAfterEdit()
 | 
				
			|||||||
bool ImGui::IsItemFocused()
 | 
					bool ImGui::IsItemFocused()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ImGuiContext& g = *GImGui;
 | 
					    ImGuiContext& g = *GImGui;
 | 
				
			||||||
    if (g.NavId != g.LastItemData.ID || g.NavId == 0)
 | 
					    return g.NavId == g.LastItemData.ID && g.NavId != 0;
 | 
				
			||||||
        return false;
 | 
					 | 
				
			||||||
    return true;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Important: this can be useful but it is NOT equivalent to the behavior of e.g.Button()!
 | 
					// Important: this can be useful but it is NOT equivalent to the behavior of e.g.Button()!
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -906,7 +906,7 @@ enum ImGuiButtonFlagsPrivate_
 | 
				
			|||||||
    ImGuiButtonFlags_DontClosePopups        = 1 << 13,  // disable automatically closing parent popup on press // [UNUSED]
 | 
					    ImGuiButtonFlags_DontClosePopups        = 1 << 13,  // disable automatically closing parent popup on press // [UNUSED]
 | 
				
			||||||
    //ImGuiButtonFlags_Disabled             = 1 << 14,  // disable interactions -> use BeginDisabled() or ImGuiItemFlags_Disabled
 | 
					    //ImGuiButtonFlags_Disabled             = 1 << 14,  // disable interactions -> use BeginDisabled() or ImGuiItemFlags_Disabled
 | 
				
			||||||
    ImGuiButtonFlags_AlignTextBaseLine      = 1 << 15,  // vertically align button to match text baseline - ButtonEx() only // FIXME: Should be removed and handled by SmallButton(), not possible currently because of DC.CursorPosPrevLine
 | 
					    ImGuiButtonFlags_AlignTextBaseLine      = 1 << 15,  // vertically align button to match text baseline - ButtonEx() only // FIXME: Should be removed and handled by SmallButton(), not possible currently because of DC.CursorPosPrevLine
 | 
				
			||||||
    ImGuiButtonFlags_NoKeyModifiers         = 1 << 16,  // disable mouse interaction if a key modifier is held
 | 
					    ImGuiButtonFlags_NoKeyModsAllowed       = 1 << 16,  // disable mouse interaction if a key modifier is held
 | 
				
			||||||
    ImGuiButtonFlags_NoHoldingActiveId      = 1 << 17,  // don't set ActiveId while holding the mouse (ImGuiButtonFlags_PressedOnClick only)
 | 
					    ImGuiButtonFlags_NoHoldingActiveId      = 1 << 17,  // don't set ActiveId while holding the mouse (ImGuiButtonFlags_PressedOnClick only)
 | 
				
			||||||
    ImGuiButtonFlags_NoNavFocus             = 1 << 18,  // don't override navigation focus when activated (FIXME: this is essentially used every time an item uses ImGuiItemFlags_NoNav, but because legacy specs don't requires LastItemData to be set ButtonBehavior(), we can't poll g.LastItemData.InFlags)
 | 
					    ImGuiButtonFlags_NoNavFocus             = 1 << 18,  // don't override navigation focus when activated (FIXME: this is essentially used every time an item uses ImGuiItemFlags_NoNav, but because legacy specs don't requires LastItemData to be set ButtonBehavior(), we can't poll g.LastItemData.InFlags)
 | 
				
			||||||
    ImGuiButtonFlags_NoHoveredOnFocus       = 1 << 19,  // don't report as hovered when nav focus is on this item
 | 
					    ImGuiButtonFlags_NoHoveredOnFocus       = 1 << 19,  // don't report as hovered when nav focus is on this item
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -561,7 +561,7 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Process initial action
 | 
					        // Process initial action
 | 
				
			||||||
        if (!(flags & ImGuiButtonFlags_NoKeyModifiers) || (!g.IO.KeyCtrl && !g.IO.KeyShift && !g.IO.KeyAlt))
 | 
					        if (!(flags & ImGuiButtonFlags_NoKeyModsAllowed) || (!g.IO.KeyCtrl && !g.IO.KeyShift && !g.IO.KeyAlt))
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            if (mouse_button_clicked != -1 && g.ActiveId != id)
 | 
					            if (mouse_button_clicked != -1 && g.ActiveId != id)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
@@ -6604,7 +6604,7 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* l
 | 
				
			|||||||
    else
 | 
					    else
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        if (window != g.HoveredWindow || !is_mouse_x_over_arrow)
 | 
					        if (window != g.HoveredWindow || !is_mouse_x_over_arrow)
 | 
				
			||||||
            button_flags |= ImGuiButtonFlags_NoKeyModifiers;
 | 
					            button_flags |= ImGuiButtonFlags_NoKeyModsAllowed;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    bool hovered, held;
 | 
					    bool hovered, held;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user