Skip to content

Commit

Permalink
Removed the inconsistent shadow under RenderCollapseTriangle() (~#707)
Browse files Browse the repository at this point in the history
  • Loading branch information
ocornut committed Oct 9, 2016
1 parent 5957af8 commit abaada4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
10 changes: 4 additions & 6 deletions imgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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));
}

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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.
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion imgui_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit abaada4

Please sign in to comment.