ColorEdit: fixed label overlapping when using style.ColorButtonPosition == ImGuiDir_Left. (#5912)
Amend 54fb051e5
+ Internals: added IsKeyboardKey(), IsMouseKey() helpers.
This commit is contained in:
parent
16476f99fd
commit
3a685749cb
@ -38,6 +38,8 @@ HOW TO UPDATE?
|
||||
- Inputs: fixed moving a window or drag and dropping from preventing input-owner-unaware code
|
||||
from accessing keys. (#5888, #4921, #456)
|
||||
- Inputs: fixed moving a window or drag and dropping from capturing mods. (#5888, #4921, #456)
|
||||
- ColorEdit: fixed label overlapping when using style.ColorButtonPosition == ImGuiDir_Left to
|
||||
move the color button on the left side (regression introduced in 1.88 WIP 2022/02/28). (#5912)
|
||||
- Backends: GLFW: cancel out errors emitted by glfwGetKeyName() when a name is missing. (#5908)
|
||||
|
||||
|
||||
|
2
imgui.h
2
imgui.h
@ -23,7 +23,7 @@
|
||||
// Library Version
|
||||
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM > 12345')
|
||||
#define IMGUI_VERSION "1.89.1 WIP"
|
||||
#define IMGUI_VERSION_NUM 18902
|
||||
#define IMGUI_VERSION_NUM 18903
|
||||
#define IMGUI_HAS_TABLE
|
||||
|
||||
/*
|
||||
|
@ -1210,8 +1210,10 @@ typedef ImBitArray<ImGuiKey_NamedKey_COUNT, -ImGuiKey_NamedKey_BEGIN> ImBitAr
|
||||
#define ImGuiKey_Keyboard_END (ImGuiKey_GamepadStart)
|
||||
#define ImGuiKey_Gamepad_BEGIN (ImGuiKey_GamepadStart)
|
||||
#define ImGuiKey_Gamepad_END (ImGuiKey_GamepadRStickDown + 1)
|
||||
#define ImGuiKey_Aliases_BEGIN (ImGuiKey_MouseLeft)
|
||||
#define ImGuiKey_Aliases_END (ImGuiKey_MouseWheelY + 1)
|
||||
#define ImGuiKey_Mouse_BEGIN (ImGuiKey_MouseLeft)
|
||||
#define ImGuiKey_Mouse_END (ImGuiKey_MouseWheelY + 1)
|
||||
#define ImGuiKey_Aliases_BEGIN (ImGuiKey_Mouse_BEGIN)
|
||||
#define ImGuiKey_Aliases_END (ImGuiKey_Mouse_END)
|
||||
|
||||
// [Internal] Named shortcuts for Navigation
|
||||
#define ImGuiKey_NavKeyboardTweakSlow ImGuiMod_Ctrl
|
||||
@ -2821,7 +2823,9 @@ namespace ImGui
|
||||
inline bool IsNamedKey(ImGuiKey key) { return key >= ImGuiKey_NamedKey_BEGIN && key < ImGuiKey_NamedKey_END; }
|
||||
inline bool IsNamedKeyOrModKey(ImGuiKey key) { return (key >= ImGuiKey_NamedKey_BEGIN && key < ImGuiKey_NamedKey_END) || key == ImGuiMod_Ctrl || key == ImGuiMod_Shift || key == ImGuiMod_Alt || key == ImGuiMod_Super; }
|
||||
inline bool IsLegacyKey(ImGuiKey key) { return key >= ImGuiKey_LegacyNativeKey_BEGIN && key < ImGuiKey_LegacyNativeKey_END; }
|
||||
inline bool IsKeyboardKey(ImGuiKey key) { return key >= ImGuiKey_Keyboard_BEGIN && key < ImGuiKey_Keyboard_END; }
|
||||
inline bool IsGamepadKey(ImGuiKey key) { return key >= ImGuiKey_Gamepad_BEGIN && key < ImGuiKey_Gamepad_END; }
|
||||
inline bool IsMouseKey(ImGuiKey key) { return key >= ImGuiKey_Mouse_BEGIN && key < ImGuiKey_Mouse_END; }
|
||||
inline bool IsAliasKey(ImGuiKey key) { return key >= ImGuiKey_Aliases_BEGIN && key < ImGuiKey_Aliases_END; }
|
||||
inline ImGuiKey ConvertSingleModFlagToKey(ImGuiKey key)
|
||||
{
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user