ColorEdit: fixed label overlapping when using style.ColorButtonPosition == ImGuiDir_Left. (#5912)

Amend 54fb051e5
+ Internals: added IsKeyboardKey(), IsMouseKey() helpers.
This commit is contained in:
ocornut
2022-11-23 14:40:58 +01:00
parent 16476f99fd
commit 3a685749cb
4 changed files with 12 additions and 3 deletions

View File

@ -5103,7 +5103,10 @@ bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flag
if (label != label_display_end && !(flags & ImGuiColorEditFlags_NoLabel))
{
// Position not necessarily next to last submitted button (e.g. if style.ColorButtonPosition == ImGuiDir_Left),
// but we need to use SameLine() to setup baseline correctly. Might want to refactor SameLine() to simplify this.
SameLine(0.0f, style.ItemInnerSpacing.x);
window->DC.CursorPos.x = pos.x + ((flags & ImGuiColorEditFlags_NoInputs) ? w_button : w_full + style.ItemInnerSpacing.x);
TextEx(label, label_display_end);
}