mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-25 00:00:40 +01:00
ColorButton(), ColorEdit4(): colored square stays square, used vertical padding on both axis.
This commit is contained in:
parent
6bb06fdb81
commit
039418f393
@ -7794,7 +7794,7 @@ bool ImGui::ColorButton(const ImVec4& col, bool small_height, bool outline_borde
|
|||||||
const ImGuiStyle& style = g.Style;
|
const ImGuiStyle& style = g.Style;
|
||||||
const ImGuiID id = window->GetID("#colorbutton");
|
const ImGuiID id = window->GetID("#colorbutton");
|
||||||
const float square_size = g.FontSize;
|
const float square_size = g.FontSize;
|
||||||
const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(square_size + style.FramePadding.x*2, square_size + (small_height ? 0 : style.FramePadding.y*2)));
|
const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(square_size + style.FramePadding.y*2, square_size + (small_height ? 0 : style.FramePadding.y*2)));
|
||||||
ItemSize(bb, small_height ? 0.0f : style.FramePadding.y);
|
ItemSize(bb, small_height ? 0.0f : style.FramePadding.y);
|
||||||
if (!ItemAdd(bb, &id))
|
if (!ItemAdd(bb, &id))
|
||||||
return false;
|
return false;
|
||||||
@ -7841,7 +7841,7 @@ bool ImGui::ColorEdit4(const char* label, float col[4], bool alpha)
|
|||||||
const ImGuiStyle& style = g.Style;
|
const ImGuiStyle& style = g.Style;
|
||||||
const ImGuiID id = window->GetID(label);
|
const ImGuiID id = window->GetID(label);
|
||||||
const float w_full = ImGui::CalcItemWidth();
|
const float w_full = ImGui::CalcItemWidth();
|
||||||
const float square_sz = (g.FontSize + style.FramePadding.x * 2.0f);
|
const float square_sz = (g.FontSize + style.FramePadding.y * 2.0f);
|
||||||
|
|
||||||
ImGuiColorEditMode edit_mode = window->DC.ColorEditMode;
|
ImGuiColorEditMode edit_mode = window->DC.ColorEditMode;
|
||||||
if (edit_mode == ImGuiColorEditMode_UserSelect || edit_mode == ImGuiColorEditMode_UserSelectShowButton)
|
if (edit_mode == ImGuiColorEditMode_UserSelect || edit_mode == ImGuiColorEditMode_UserSelectShowButton)
|
||||||
|
Loading…
Reference in New Issue
Block a user