mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-11-04 15:11:05 +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);
 | 
			
		||||
 
 | 
			
		||||
@@ -717,7 +717,7 @@ namespace ImGui
 | 
			
		||||
    IMGUI_API void          RenderTextWrapped(ImVec2 pos, const char* text, const char* text_end, float wrap_width);
 | 
			
		||||
    IMGUI_API void          RenderTextClipped(const ImVec2& pos_min, const ImVec2& pos_max, const char* text, const char* text_end, const ImVec2* text_size_if_known, const ImVec2& align = ImVec2(0,0), const ImRect* clip_rect = NULL);
 | 
			
		||||
    IMGUI_API void          RenderFrame(ImVec2 p_min, ImVec2 p_max, ImU32 fill_col, bool border = true, float rounding = 0.0f);
 | 
			
		||||
    IMGUI_API void          RenderCollapseTriangle(ImVec2 pos, bool is_open, float scale = 1.0f, bool shadow = false);
 | 
			
		||||
    IMGUI_API void          RenderCollapseTriangle(ImVec2 pos, bool is_open, float scale = 1.0f);
 | 
			
		||||
    IMGUI_API void          RenderBullet(ImVec2 pos);
 | 
			
		||||
    IMGUI_API void          RenderCheckMark(ImVec2 pos, ImU32 col);
 | 
			
		||||
    IMGUI_API const char*   FindRenderedTextEnd(const char* text, const char* text_end = NULL); // Find the optional ## from which we stop displaying text.
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user