mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-11-04 07:01:04 +01:00 
			
		
		
		
	Removed the inconsistent shadow under RenderCollapseTriangle() (~#707)
This commit is contained in:
		
							
								
								
									
										10
									
								
								imgui.cpp
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								imgui.cpp
									
									
									
									
									
								
							@@ -2929,7 +2929,7 @@ void ImGui::RenderFrame(ImVec2 p_min, ImVec2 p_max, ImU32 fill_col, bool border,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Render a triangle to denote expanded/collapsed state
 | 
			
		||||
void ImGui::RenderCollapseTriangle(ImVec2 p_min, bool is_open, float scale, bool shadow)
 | 
			
		||||
void ImGui::RenderCollapseTriangle(ImVec2 p_min, bool is_open, float scale)
 | 
			
		||||
{
 | 
			
		||||
    ImGuiContext& g = *GImGui;
 | 
			
		||||
    ImGuiWindow* window = GetCurrentWindow();
 | 
			
		||||
@@ -2953,8 +2953,6 @@ void ImGui::RenderCollapseTriangle(ImVec2 p_min, bool is_open, float scale, bool
 | 
			
		||||
        c = center + ImVec2(-0.500f,-0.866f)*r;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (shadow && (window->Flags & ImGuiWindowFlags_ShowBorders) != 0)
 | 
			
		||||
        window->DrawList->AddTriangleFilled(a+ImVec2(2,2), b+ImVec2(2,2), c+ImVec2(2,2), GetColorU32(ImGuiCol_BorderShadow));
 | 
			
		||||
    window->DrawList->AddTriangleFilled(a, b, c, GetColorU32(ImGuiCol_Text));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -4312,7 +4310,7 @@ bool ImGui::Begin(const char* name, bool* p_open, const ImVec2& size_on_first_us
 | 
			
		||||
 | 
			
		||||
            const ImVec2 text_size = CalcTextSize(name, NULL, true);
 | 
			
		||||
            if (!(flags & ImGuiWindowFlags_NoCollapse))
 | 
			
		||||
                RenderCollapseTriangle(window->Pos + style.FramePadding, !window->Collapsed, 1.0f, true);
 | 
			
		||||
                RenderCollapseTriangle(window->Pos + style.FramePadding, !window->Collapsed, 1.0f);
 | 
			
		||||
 | 
			
		||||
            ImVec2 text_min = window->Pos;
 | 
			
		||||
            ImVec2 text_max = window->Pos + ImVec2(window->Size.x, style.FramePadding.y*2 + text_size.y);
 | 
			
		||||
@@ -5950,7 +5948,7 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* l
 | 
			
		||||
    {
 | 
			
		||||
        // Framed type
 | 
			
		||||
        RenderFrame(bb.Min, bb.Max, col, true, style.FrameRounding);
 | 
			
		||||
        RenderCollapseTriangle(bb.Min + padding + ImVec2(0.0f, text_base_offset_y), is_open, 1.0f, true);
 | 
			
		||||
        RenderCollapseTriangle(bb.Min + padding + ImVec2(0.0f, text_base_offset_y), is_open, 1.0f);
 | 
			
		||||
        if (g.LogEnabled)
 | 
			
		||||
        {
 | 
			
		||||
            // NB: '##' is normally used to hide text (as a library-wide feature), so we need to specify the text range to make sure the ## aren't stripped out here.
 | 
			
		||||
@@ -5974,7 +5972,7 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* l
 | 
			
		||||
        if (flags & ImGuiTreeNodeFlags_Bullet)
 | 
			
		||||
            RenderBullet(bb.Min + ImVec2(text_offset_x * 0.5f, g.FontSize*0.50f + text_base_offset_y));
 | 
			
		||||
        else if (!(flags & ImGuiTreeNodeFlags_Leaf))
 | 
			
		||||
            RenderCollapseTriangle(bb.Min + ImVec2(padding.x, g.FontSize*0.15f + text_base_offset_y), is_open, 0.70f, false);
 | 
			
		||||
            RenderCollapseTriangle(bb.Min + ImVec2(padding.x, g.FontSize*0.15f + text_base_offset_y), is_open, 0.70f);
 | 
			
		||||
        if (g.LogEnabled)
 | 
			
		||||
            LogRenderedText(text_pos, ">");
 | 
			
		||||
        RenderText(text_pos, label, label_end, false);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user