mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-10-31 13:11:05 +01:00 
			
		
		
		
	Nav: More consistently drawing a (thin) navigation rectangle hover filled frames such as tree nodes, collapsing header, menus. (#787)
This commit is contained in:
		| @@ -3878,7 +3878,7 @@ void ImGui::RenderNavHighlight(const ImRect& bb, ImGuiID id, ImGuiNavHighlightFl | |||||||
|     ImGuiContext& g = *GImGui; |     ImGuiContext& g = *GImGui; | ||||||
|     if (id != g.NavId) |     if (id != g.NavId) | ||||||
|         return; |         return; | ||||||
|     if (g.NavDisableHighlight && !(flags & ImGuiNavHighlightFlags_AlwaysRender)) |     if (g.NavDisableHighlight && !(flags & ImGuiNavHighlightFlags_AlwaysDraw)) | ||||||
|         return;     |         return;     | ||||||
|     ImGuiWindow* window = ImGui::GetCurrentWindow(); |     ImGuiWindow* window = ImGui::GetCurrentWindow(); | ||||||
|  |  | ||||||
| @@ -7204,6 +7204,7 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* l | |||||||
|     { |     { | ||||||
|         // Framed type |         // Framed type | ||||||
|         RenderFrame(bb.Min, bb.Max, col, true, style.FrameRounding); |         RenderFrame(bb.Min, bb.Max, col, true, style.FrameRounding); | ||||||
|  |         RenderNavHighlight(bb, id, ImGuiNavHighlightFlags_TypeThin); | ||||||
|         RenderCollapseTriangle(bb.Min + ImVec2(padding.x, text_base_offset_y), is_open, 1.0f); |         RenderCollapseTriangle(bb.Min + ImVec2(padding.x, text_base_offset_y), is_open, 1.0f); | ||||||
|         if (g.LogEnabled) |         if (g.LogEnabled) | ||||||
|         { |         { | ||||||
| @@ -7223,8 +7224,10 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* l | |||||||
|     { |     { | ||||||
|         // Unframed typed for tree nodes |         // Unframed typed for tree nodes | ||||||
|         if (hovered || (flags & ImGuiTreeNodeFlags_Selected)) |         if (hovered || (flags & ImGuiTreeNodeFlags_Selected)) | ||||||
|  |         { | ||||||
|             RenderFrame(bb.Min, bb.Max, col, false); |             RenderFrame(bb.Min, bb.Max, col, false); | ||||||
|  |             RenderNavHighlight(bb, id, ImGuiNavHighlightFlags_TypeThin); | ||||||
|  |         } | ||||||
|         if (flags & ImGuiTreeNodeFlags_Bullet) |         if (flags & ImGuiTreeNodeFlags_Bullet) | ||||||
|             RenderBullet(bb.Min + ImVec2(text_offset_x * 0.5f, g.FontSize*0.50f + text_base_offset_y)); |             RenderBullet(bb.Min + ImVec2(text_offset_x * 0.5f, g.FontSize*0.50f + text_base_offset_y)); | ||||||
|         else if (!(flags & ImGuiTreeNodeFlags_Leaf)) |         else if (!(flags & ImGuiTreeNodeFlags_Leaf)) | ||||||
| @@ -9914,6 +9917,7 @@ bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags fl | |||||||
|     { |     { | ||||||
|         const ImU32 col = GetColorU32((held && hovered) ? ImGuiCol_HeaderActive : hovered ? ImGuiCol_HeaderHovered : ImGuiCol_Header); |         const ImU32 col = GetColorU32((held && hovered) ? ImGuiCol_HeaderActive : hovered ? ImGuiCol_HeaderHovered : ImGuiCol_Header); | ||||||
|         RenderFrame(bb_with_spacing.Min, bb_with_spacing.Max, col, false, 0.0f); |         RenderFrame(bb_with_spacing.Min, bb_with_spacing.Max, col, false, 0.0f); | ||||||
|  |         RenderNavHighlight(bb_with_spacing, id, ImGuiNavHighlightFlags_TypeThin); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     if ((flags & ImGuiSelectableFlags_SpanAllColumns) && window->DC.ColumnsCount > 1) |     if ((flags & ImGuiSelectableFlags_SpanAllColumns) && window->DC.ColumnsCount > 1) | ||||||
|   | |||||||
| @@ -255,7 +255,7 @@ enum ImGuiNavHighlightFlags_ | |||||||
| { | { | ||||||
|     ImGuiNavHighlightFlags_TypeDefault  = 1 << 0, |     ImGuiNavHighlightFlags_TypeDefault  = 1 << 0, | ||||||
|     ImGuiNavHighlightFlags_TypeThin     = 1 << 1, |     ImGuiNavHighlightFlags_TypeThin     = 1 << 1, | ||||||
|     ImGuiNavHighlightFlags_AlwaysRender = 1 << 2 |     ImGuiNavHighlightFlags_AlwaysDraw   = 1 << 2 | ||||||
| }; | }; | ||||||
|  |  | ||||||
| enum ImGuiCorner | enum ImGuiCorner | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user