mirror of
https://github.com/xemu-project/imgui.git
synced 2024-11-27 20:20:25 +00:00
Selectable(): not specifying a width default to using max of label width and remaining width
This commit is contained in:
parent
3268646180
commit
325e292427
@ -6527,7 +6527,7 @@ bool ImGui::Selectable(const char* label, bool selected, const ImVec2& size_arg)
|
||||
const ImGuiID id = window->GetID(label);
|
||||
const ImVec2 label_size = CalcTextSize(label, NULL, true);
|
||||
|
||||
const float w = window->Pos.x + ImGui::GetContentRegionMax().x - window->DC.CursorPos.x;
|
||||
const float w = ImMax(label_size.x, window->Pos.x + ImGui::GetContentRegionMax().x - window->DC.CursorPos.x);
|
||||
const ImVec2 size(size_arg.x != 0.0f ? size_arg.x : w, size_arg.y != 0.0f ? size_arg.y : label_size.y);
|
||||
const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size);
|
||||
ItemSize(bb);
|
||||
|
Loading…
Reference in New Issue
Block a user