Skip to content

Commit ee48ffe

Browse files
committed
Added comments about line/rect thickness needing scaling. (#7031)
1 parent 5679de6 commit ee48ffe

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

imgui.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -5617,7 +5617,7 @@ static void ImGui::RenderDimmedBackgrounds()
56175617
if (window->DrawList->CmdBuffer.Size == 0)
56185618
window->DrawList->AddDrawCmd();
56195619
window->DrawList->PushClipRect(viewport->Pos, viewport->Pos + viewport->Size);
5620-
window->DrawList->AddRect(bb.Min, bb.Max, GetColorU32(ImGuiCol_NavWindowingHighlight, g.NavWindowingHighlightAlpha), window->WindowRounding, 0, 3.0f);
5620+
window->DrawList->AddRect(bb.Min, bb.Max, GetColorU32(ImGuiCol_NavWindowingHighlight, g.NavWindowingHighlightAlpha), window->WindowRounding, 0, 3.0f); // FIXME-DPI
56215621
window->DrawList->PopClipRect();
56225622
}
56235623
}
@@ -14307,7 +14307,7 @@ void ImGui::RenderDragDropTargetRect(const ImRect& bb, const ImRect& item_clip_r
1430714307
bool push_clip_rect = !window->ClipRect.Contains(bb_display);
1430814308
if (push_clip_rect)
1430914309
window->DrawList->PushClipRectFullScreen();
14310-
window->DrawList->AddRect(bb_display.Min, bb_display.Max, GetColorU32(ImGuiCol_DragDropTarget), 0.0f, 0, 2.0f);
14310+
window->DrawList->AddRect(bb_display.Min, bb_display.Max, GetColorU32(ImGuiCol_DragDropTarget), 0.0f, 0, 2.0f); // FIXME-DPI
1431114311
if (push_clip_rect)
1431214312
window->DrawList->PopClipRect();
1431314313
}

imgui_widgets.cpp

+10-9
Original file line numberDiff line numberDiff line change
@@ -867,11 +867,12 @@ bool ImGui::CloseButton(ImGuiID id, const ImVec2& pos)
867867
if (hovered)
868868
window->DrawList->AddRectFilled(bb.Min, bb.Max, bg_col);
869869
RenderNavCursor(bb, id, ImGuiNavRenderCursorFlags_Compact);
870-
ImU32 cross_col = GetColorU32(ImGuiCol_Text);
871-
ImVec2 cross_center = bb.GetCenter() - ImVec2(0.5f, 0.5f);
872-
float cross_extent = g.FontSize * 0.5f * 0.7071f - 1.0f;
873-
window->DrawList->AddLine(cross_center + ImVec2(+cross_extent, +cross_extent), cross_center + ImVec2(-cross_extent, -cross_extent), cross_col, 1.0f);
874-
window->DrawList->AddLine(cross_center + ImVec2(+cross_extent, -cross_extent), cross_center + ImVec2(-cross_extent, +cross_extent), cross_col, 1.0f);
870+
const ImU32 cross_col = GetColorU32(ImGuiCol_Text);
871+
const ImVec2 cross_center = bb.GetCenter() - ImVec2(0.5f, 0.5f);
872+
const float cross_extent = g.FontSize * 0.5f * 0.7071f - 1.0f;
873+
const float cross_thickness = 1.0f; // FIXME-DPI
874+
window->DrawList->AddLine(cross_center + ImVec2(+cross_extent, +cross_extent), cross_center + ImVec2(-cross_extent, -cross_extent), cross_col, cross_thickness);
875+
window->DrawList->AddLine(cross_center + ImVec2(+cross_extent, -cross_extent), cross_center + ImVec2(-cross_extent, +cross_extent), cross_col, cross_thickness);
875876

876877
return pressed;
877878
}
@@ -1478,7 +1479,7 @@ bool ImGui::TextLink(const char* label)
14781479
}
14791480

14801481
float line_y = bb.Max.y + ImFloor(g.Font->Descent * g.FontScale * 0.20f);
1481-
window->DrawList->AddLine(ImVec2(bb.Min.x, line_y), ImVec2(bb.Max.x, line_y), GetColorU32(line_colf)); // FIXME-TEXT: Underline mode.
1482+
window->DrawList->AddLine(ImVec2(bb.Min.x, line_y), ImVec2(bb.Max.x, line_y), GetColorU32(line_colf)); // FIXME-TEXT: Underline mode // FIXME-DPI
14821483

14831484
PushStyleColor(ImGuiCol_Text, GetColorU32(text_colf));
14841485
RenderText(bb.Min, label, label_end);
@@ -5339,7 +5340,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
53395340
ImVec2 cursor_screen_pos = ImTrunc(draw_pos + cursor_offset - draw_scroll);
53405341
ImRect cursor_screen_rect(cursor_screen_pos.x, cursor_screen_pos.y - g.FontSize + 0.5f, cursor_screen_pos.x + 1.0f, cursor_screen_pos.y - 1.5f);
53415342
if (cursor_is_visible && cursor_screen_rect.Overlaps(clip_rect))
5342-
draw_window->DrawList->AddLine(cursor_screen_rect.Min, cursor_screen_rect.GetBL(), GetColorU32(ImGuiCol_Text));
5343+
draw_window->DrawList->AddLine(cursor_screen_rect.Min, cursor_screen_rect.GetBL(), GetColorU32(ImGuiCol_Text), 1.0f); // FIXME-DPI: Cursor thickness (#7031) + Color
53435344

53445345
// Notify OS of text input position for advanced IME (-1 x offset so that Windows IME can cover our cursor. Bit of an extra nicety.)
53455346
if (!is_readonly)
@@ -6207,7 +6208,7 @@ bool ImGui::ColorButton(const char* desc_id, const ImVec4& col, ImGuiColorEditFl
62076208
if (g.Style.FrameBorderSize > 0.0f)
62086209
RenderFrameBorder(bb.Min, bb.Max, rounding);
62096210
else
6210-
window->DrawList->AddRect(bb.Min, bb.Max, GetColorU32(ImGuiCol_FrameBg), rounding); // Color buttons are often in need of some sort of border
6211+
window->DrawList->AddRect(bb.Min, bb.Max, GetColorU32(ImGuiCol_FrameBg), rounding); // Color buttons are often in need of some sort of border // FIXME-DPI
62116212
}
62126213

62136214
// Drag and Drop Source
@@ -7486,7 +7487,7 @@ void ImGui::EndBoxSelect(const ImRect& scope_rect, ImGuiMultiSelectFlags ms_flag
74867487
ImRect box_select_r = bs->BoxSelectRectCurr;
74877488
box_select_r.ClipWith(scope_rect);
74887489
window->DrawList->AddRectFilled(box_select_r.Min, box_select_r.Max, GetColorU32(ImGuiCol_SeparatorHovered, 0.30f)); // FIXME-MULTISELECT: Styling
7489-
window->DrawList->AddRect(box_select_r.Min, box_select_r.Max, GetColorU32(ImGuiCol_NavCursor)); // FIXME-MULTISELECT: Styling
7490+
window->DrawList->AddRect(box_select_r.Min, box_select_r.Max, GetColorU32(ImGuiCol_NavCursor)); // FIXME-MULTISELECT FIXME-DPI: Styling
74907491

74917492
// Scroll
74927493
const bool enable_scroll = (ms_flags & ImGuiMultiSelectFlags_ScopeWindow) && (ms_flags & ImGuiMultiSelectFlags_BoxSelectNoScroll) == 0;

0 commit comments

Comments
 (0)