Fix:icon center
jira: STUDIO-10393 Change-Id: Iec33b3e689b8bbf4749ead21f830ba7b6521ee2e
This commit is contained in:
parent
0b4795fd10
commit
3fb7d857d5
|
@ -2926,7 +2926,7 @@ void ImGuiWrapper::filament_group(const std::string& filament_type, const char*
|
||||||
ImVec2 text_size = ImGui::CalcTextSize(filament_type.c_str());
|
ImVec2 text_size = ImGui::CalcTextSize(filament_type.c_str());
|
||||||
// BBS image sizing based on text width (DPI scaling)
|
// BBS image sizing based on text width (DPI scaling)
|
||||||
float img_width = ImGui::CalcTextSize("ABC").x;
|
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);
|
ImVec2 id_text_size = this->calc_text_size(id);
|
||||||
unsigned char rgba[4];
|
unsigned char rgba[4];
|
||||||
rgba[3] = 0xff;
|
rgba[3] = 0xff;
|
||||||
|
@ -2943,7 +2943,7 @@ void ImGuiWrapper::filament_group(const std::string& filament_type, const char*
|
||||||
// image border test
|
// 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));
|
// 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();
|
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];
|
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);
|
ImVec4 text_color = gray < 80 ? ImVec4(1.0f, 1.0f, 1.0f, 1.0f) : ImVec4(0, 0, 0, 1.0f);
|
||||||
|
|
Loading…
Reference in New Issue