InputScalar custom hex sizing adjustment
This commit is contained in:
@@ -4,6 +4,7 @@
|
|||||||
#include <imgui/imgui_internal.h>
|
#include <imgui/imgui_internal.h>
|
||||||
|
|
||||||
#include "absl/strings/string_view.h"
|
#include "absl/strings/string_view.h"
|
||||||
|
|
||||||
namespace ImGui {
|
namespace ImGui {
|
||||||
|
|
||||||
static inline ImGuiInputTextFlags InputScalar_DefaultCharsFilter(
|
static inline ImGuiInputTextFlags InputScalar_DefaultCharsFilter(
|
||||||
@@ -31,17 +32,11 @@ bool InputScalarLeft(const char* label, ImGuiDataType data_type, void* p_data,
|
|||||||
char buf[64];
|
char buf[64];
|
||||||
DataTypeFormatString(buf, IM_ARRAYSIZE(buf), data_type, p_data, format);
|
DataTypeFormatString(buf, IM_ARRAYSIZE(buf), data_type, p_data, format);
|
||||||
|
|
||||||
// Testing ActiveId as a minor optimization as filtering is not needed until
|
|
||||||
// active
|
|
||||||
if (g.ActiveId == 0 && (flags & (ImGuiInputTextFlags_CharsDecimal |
|
if (g.ActiveId == 0 && (flags & (ImGuiInputTextFlags_CharsDecimal |
|
||||||
ImGuiInputTextFlags_CharsHexadecimal |
|
ImGuiInputTextFlags_CharsHexadecimal |
|
||||||
ImGuiInputTextFlags_CharsScientific)) == 0)
|
ImGuiInputTextFlags_CharsScientific)) == 0)
|
||||||
flags |= InputScalar_DefaultCharsFilter(data_type, format);
|
flags |= InputScalar_DefaultCharsFilter(data_type, format);
|
||||||
flags |=
|
flags |= ImGuiInputTextFlags_AutoSelectAll | ImGuiInputTextFlags_NoMarkEdited;
|
||||||
ImGuiInputTextFlags_AutoSelectAll |
|
|
||||||
ImGuiInputTextFlags_NoMarkEdited; // We call MarkItemEdited() ourselves
|
|
||||||
// by comparing the actual data rather
|
|
||||||
// than the string.
|
|
||||||
|
|
||||||
bool value_changed = false;
|
bool value_changed = false;
|
||||||
if (p_step == NULL) {
|
if (p_step == NULL) {
|
||||||
@@ -59,9 +54,9 @@ bool InputScalarLeft(const char* label, ImGuiDataType data_type, void* p_data,
|
|||||||
|
|
||||||
// Place the label on the left of the input field
|
// Place the label on the left of the input field
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing,
|
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing,
|
||||||
ImVec2{style.ItemSpacing.x, style.ItemSpacing.y * 2});
|
ImVec2{style.ItemSpacing.x, style.ItemSpacing.y});
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding,
|
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding,
|
||||||
ImVec2{style.FramePadding.x, style.FramePadding.y * 2});
|
ImVec2{style.FramePadding.x, style.FramePadding.y});
|
||||||
ImGui::AlignTextToFramePadding();
|
ImGui::AlignTextToFramePadding();
|
||||||
ImGui::Text("%s", label);
|
ImGui::Text("%s", label);
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
|
|||||||
Reference in New Issue
Block a user