Unify panel search behavior and polish console UI
This commit is contained in:
@@ -192,11 +192,35 @@ inline bool ToolbarSearchField(
|
||||
char* buffer,
|
||||
size_t bufferSize,
|
||||
float trailingWidth = 0.0f) {
|
||||
const float originalCursorY = ImGui::GetCursorPosY();
|
||||
const float verticalOffset = SearchFieldVerticalOffset();
|
||||
if (verticalOffset != 0.0f) {
|
||||
const float nextCursorY = originalCursorY + verticalOffset;
|
||||
ImGui::SetCursorPosY(nextCursorY > 0.0f ? nextCursorY : 0.0f);
|
||||
}
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, SearchFieldFramePadding());
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, SearchFieldFrameRounding());
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBg, ToolbarButtonColor(false));
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, ToolbarButtonHoveredColor(false));
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBgActive, ToolbarButtonActiveColor());
|
||||
const float width = ImGui::GetContentRegionAvail().x - trailingWidth;
|
||||
ImGui::SetNextItemWidth(width > 0.0f ? width : 0.0f);
|
||||
const bool changed = ImGui::InputTextWithHint(id, hint, buffer, bufferSize);
|
||||
|
||||
const ImVec2 min = ImGui::GetItemRectMin();
|
||||
const ImVec2 max = ImGui::GetItemRectMax();
|
||||
const ImVec2 center(min.x + SearchFieldFramePadding().x * 0.5f, (min.y + max.y) * 0.5f);
|
||||
ImDrawList* drawList = ImGui::GetWindowDrawList();
|
||||
const ImU32 glyphColor = ImGui::GetColorU32(ConsoleSecondaryTextColor());
|
||||
drawList->AddCircle(center, 4.0f, glyphColor, 16, 1.5f);
|
||||
drawList->AddLine(
|
||||
ImVec2(center.x + 3.0f, center.y + 3.0f),
|
||||
ImVec2(center.x + 7.0f, center.y + 7.0f),
|
||||
glyphColor,
|
||||
1.5f);
|
||||
|
||||
ImGui::PopStyleColor(3);
|
||||
ImGui::PopStyleVar(2);
|
||||
return changed;
|
||||
}
|
||||
@@ -514,7 +538,7 @@ inline ComponentSectionResult BeginComponentSection(
|
||||
style.FrameBorderSize);
|
||||
}
|
||||
|
||||
DrawDisclosureArrow(drawList, arrowRect.Min, arrowRect.Max, open, ImGui::GetColorU32(ImGuiCol_Text));
|
||||
DrawDisclosureArrow(drawList, arrowRect.Min, arrowRect.Max, open, ImGui::GetColorU32(DisclosureArrowColor()));
|
||||
|
||||
if (label && label[0] != '\0') {
|
||||
const float textX = itemMin.x + arrowSlotWidth;
|
||||
|
||||
Reference in New Issue
Block a user