mirror of
				https://github.com/ocornut/imgui.git
				synced 2025-10-26 12:27:30 +00:00 
			
		
		
		
	Nav: Internals: Renamed ImGuiButtonFlags_NoNavOverride to ImGuiButtonFlags_NoNavFocus + fixed a theorically missing test in ButtonBehavior() (#787)
This commit is contained in:
		| @@ -5214,7 +5214,7 @@ bool ImGui::Begin(const char* name, bool* p_open, const ImVec2& size_on_first_us | |||||||
|                 const ImRect resize_rect(br - ImVec2(resize_corner_size * 0.75f, resize_corner_size * 0.75f), br); |                 const ImRect resize_rect(br - ImVec2(resize_corner_size * 0.75f, resize_corner_size * 0.75f), br); | ||||||
|                 const ImGuiID resize_id = window->GetID("#RESIZE"); |                 const ImGuiID resize_id = window->GetID("#RESIZE"); | ||||||
|                 bool hovered, held; |                 bool hovered, held; | ||||||
|                 ButtonBehavior(resize_rect, resize_id, &hovered, &held, ImGuiButtonFlags_FlattenChilds | ImGuiButtonFlags_NoNavOverride); |                 ButtonBehavior(resize_rect, resize_id, &hovered, &held, ImGuiButtonFlags_FlattenChilds | ImGuiButtonFlags_NoNavFocus); | ||||||
|                 if (hovered || held) |                 if (hovered || held) | ||||||
|                     g.MouseCursor = ImGuiMouseCursor_ResizeNWSE; |                     g.MouseCursor = ImGuiMouseCursor_ResizeNWSE; | ||||||
|  |  | ||||||
| @@ -5567,7 +5567,7 @@ static void Scrollbar(ImGuiWindow* window, bool horizontal) | |||||||
|     bool held = false; |     bool held = false; | ||||||
|     bool hovered = false; |     bool hovered = false; | ||||||
|     const bool previously_held = (g.ActiveId == id); |     const bool previously_held = (g.ActiveId == id); | ||||||
|     ImGui::ButtonBehavior(bb, id, &hovered, &held, ImGuiButtonFlags_NoNavOverride); |     ImGui::ButtonBehavior(bb, id, &hovered, &held, ImGuiButtonFlags_NoNavFocus); | ||||||
|  |  | ||||||
|     float scroll_max = ImMax(1.0f, win_size_contents_v - win_size_avail_v); |     float scroll_max = ImMax(1.0f, win_size_contents_v - win_size_avail_v); | ||||||
|     float scroll_ratio = ImSaturate(scroll_v / scroll_max); |     float scroll_ratio = ImSaturate(scroll_v / scroll_max); | ||||||
| @@ -6715,7 +6715,7 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool | |||||||
|             if ((flags & ImGuiButtonFlags_PressedOnClickRelease) && g.IO.MouseClicked[0]) |             if ((flags & ImGuiButtonFlags_PressedOnClickRelease) && g.IO.MouseClicked[0]) | ||||||
|             { |             { | ||||||
|                 SetActiveID(id, window); |                 SetActiveID(id, window); | ||||||
|                 if (!(flags & ImGuiButtonFlags_NoNavOverride)) |                 if (!(flags & ImGuiButtonFlags_NoNavFocus)) | ||||||
|                     SetFocusID(id, window); |                     SetFocusID(id, window); | ||||||
|                 FocusWindow(window); |                 FocusWindow(window); | ||||||
|                 g.ActiveIdClickOffset = g.IO.MousePos - bb.Min; |                 g.ActiveIdClickOffset = g.IO.MousePos - bb.Min; | ||||||
| @@ -6759,6 +6759,7 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool | |||||||
|             // Set active id so it can be queried by user via IsItemActive(), equivalent of holding the mouse button. |             // Set active id so it can be queried by user via IsItemActive(), equivalent of holding the mouse button. | ||||||
|             g.NavActivateId = id; // This is so SetActiveId assign a Nav source |             g.NavActivateId = id; // This is so SetActiveId assign a Nav source | ||||||
|             SetActiveID(id, window); |             SetActiveID(id, window); | ||||||
|  |             if (!(flags & ImGuiButtonFlags_NoNavFocus)) | ||||||
|                 SetFocusID(id, window); |                 SetFocusID(id, window); | ||||||
|             g.ActiveIdAllowNavDirFlags = (1 << ImGuiDir_Left) | (1 << ImGuiDir_Right) | (1 << ImGuiDir_Up) | (1 << ImGuiDir_Down); |             g.ActiveIdAllowNavDirFlags = (1 << ImGuiDir_Left) | (1 << ImGuiDir_Right) | (1 << ImGuiDir_Up) | (1 << ImGuiDir_Down); | ||||||
|         } |         } | ||||||
| @@ -6780,7 +6781,7 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool | |||||||
|                         pressed = true; |                         pressed = true; | ||||||
|                 ClearActiveID(); |                 ClearActiveID(); | ||||||
|             } |             } | ||||||
|             if (!(flags & ImGuiButtonFlags_NoNavOverride)) |             if (!(flags & ImGuiButtonFlags_NoNavFocus)) | ||||||
|                 g.NavDisableHighlight = true; |                 g.NavDisableHighlight = true; | ||||||
|         } |         } | ||||||
|         else if (g.ActiveIdSource == ImGuiInputSource_Nav) |         else if (g.ActiveIdSource == ImGuiInputSource_Nav) | ||||||
|   | |||||||
| @@ -182,7 +182,7 @@ enum ImGuiButtonFlags_ | |||||||
|     ImGuiButtonFlags_AlignTextBaseLine      = 1 << 8,   // 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 << 8,   // 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 << 9,   // disable interaction if a key modifier is held |     ImGuiButtonFlags_NoKeyModifiers         = 1 << 9,   // disable interaction if a key modifier is held | ||||||
|     ImGuiButtonFlags_AllowOverlapMode       = 1 << 10,  // require previous frame HoveredId to either match id or be null before being usable |     ImGuiButtonFlags_AllowOverlapMode       = 1 << 10,  // require previous frame HoveredId to either match id or be null before being usable | ||||||
|     ImGuiButtonFlags_NoNavOverride          = 1 << 11   // don't override navigation id when activated |     ImGuiButtonFlags_NoNavFocus             = 1 << 11   // don't override navigation focus when activated | ||||||
| }; | }; | ||||||
|  |  | ||||||
| enum ImGuiSliderFlags_ | enum ImGuiSliderFlags_ | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 omar
					omar