From a5cc2e4161e79b36823c44791c266a322ef471cc Mon Sep 17 00:00:00 2001 From: omar Date: Fri, 5 Dec 2014 12:34:14 +0000 Subject: [PATCH] Fixed InputInt() writing to output when it doesn't need to, which break with large int due to int<>float conversions. Added todo note. --- imgui.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index 4d200bb8..63bc6619 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -201,7 +201,8 @@ - main: make IsHovered() info stored in a stack? so that 'if TreeNode() { Text; TreePop; } if IsHovered' return the hover state of the TreeNode? - scrollbar: use relative mouse movement when first-clicking inside of scroll grab box. - scrollbar: make the grab visible and a minimum size for long scroll regions - - input number: optional range min/max +!- input number: very large int not reliably supported because of int<>float conversions. + - input number: optional range min/max for Input*() functions - input number: holding [-]/[+] buttons should increase the step non-linearly - input number: use mouse wheel to step up/down - layout: clean up the InputFloatN/SliderFloatN/ColorEdit4 horrible layout code. item width should include frame padding, then we can have a generic horizontal layout helper. @@ -4341,7 +4342,8 @@ bool ImGui::InputInt(const char* label, int *v, int step, int step_fast, ImGuiIn { float f = (float)*v; const bool value_changed = ImGui::InputFloat(label, &f, (float)step, (float)step_fast, 0, extra_flags); - *v = (int)f; + if (value_changed) + *v = (int)f; return value_changed; }