Fix:icon center

jira: STUDIO-10393
Change-Id: Iec33b3e689b8bbf4749ead21f830ba7b6521ee2e
This commit is contained in:
Mack 2025-02-13 17:59:21 +08:00 committed by lane.wei
parent 0b4795fd10
commit 3fb7d857d5
1 changed files with 2 additions and 2 deletions

View File

@ -2926,7 +2926,7 @@ void ImGuiWrapper::filament_group(const std::string& filament_type, const char*
ImVec2 text_size = ImGui::CalcTextSize(filament_type.c_str());
// BBS image sizing based on text width (DPI scaling)
float img_width = ImGui::CalcTextSize("ABC").x;
ImVec2 img_size = { img_width, img_width * 1.5f };
ImVec2 img_size = { img_width, img_width };
ImVec2 id_text_size = this->calc_text_size(id);
unsigned char rgba[4];
rgba[3] = 0xff;
@ -2943,7 +2943,7 @@ void ImGuiWrapper::filament_group(const std::string& filament_type, const char*
// image border test
// draw_list->AddRect(cursor_pos, {cursor_pos.x + img_size.x, cursor_pos.y + img_size.y}, IM_COL32(0, 0, 0, 255));
ImVec2 current_cursor = ImGui::GetCursorPos();
ImGui::SetCursorPos({ current_cursor.x + (img_size.x - id_text_size.x) * 0.5f, current_cursor.y + (img_size.y - id_text_size.y) * 0.5f - 7 });
ImGui::SetCursorPos({ current_cursor.x + (img_size.x - id_text_size.x) * 0.5f, current_cursor.y + (img_size.y - id_text_size.y) * 0.5f });
float gray = 0.299 * rgba[0] + 0.587 * rgba[1] + 0.114 * rgba[2];
ImVec4 text_color = gray < 80 ? ImVec4(1.0f, 1.0f, 1.0f, 1.0f) : ImVec4(0, 0, 0, 1.0f);