Browse Source

SliderFloat, DragFloat: Fix to allow input of scientific notation when Ctrl+Clicking a slider or drag, matching the change done in c19b2781 for InputFloat(). (#648, #1011)

pull/1790/head
omar 7 years ago
parent
commit
8a38271a7c
  1. 1
      CHANGELOG.txt
  2. 3
      imgui.cpp

1
CHANGELOG.txt

@ -58,6 +58,7 @@ Other Changes:
- InputText: On Mac OS X, support Cmd+Shift+Z for Redo. Cmd+Y is also supported as major apps seems to default to support both. (#1765) [@lfnoise]
- InputText: Fixed returning true when edition is cancelled with Esc and the current buffer matches the initial value.
- DragFloat, DragInt: Cancel mouse tweak when current value is initially past the min/max boundaries and mouse is pushing in the same direction (keyboard/gamepad version already did this).
- DragFloat, SliderFloat: Fix to allow input of scientific notation numbers when using CTRL+Click to input the value. (~#648, #1011)
- Style: Changed default style.DisplaySafeAreaPadding values from (4,4) to (3,3) so it is smaller than FramePadding and has no effect on main menu bar on a computer. (#1439)
- Misc: Added IMGUI_CHECKVERSION() macro to compare version string and data structure sizes in order to catch issues with mismatching compilation unit settings. (#1695, #1769)
- Demo: Fixed Overlay: Added a context menu item to enable freely moving the window.

3
imgui.cpp

@ -8595,7 +8595,8 @@ bool ImGui::InputScalarAsWidgetReplacement(const ImRect& aabb, const char* label
char buf[32];
DataTypeFormatString(buf, IM_ARRAYSIZE(buf), data_type, data_ptr, decimal_precision);
bool text_value_changed = InputTextEx(label, buf, IM_ARRAYSIZE(buf), aabb.GetSize(), ImGuiInputTextFlags_CharsDecimal | ImGuiInputTextFlags_AutoSelectAll);
ImGuiInputTextFlags flags = ImGuiInputTextFlags_AutoSelectAll | ((data_type == ImGuiDataType_Float || data_type == ImGuiDataType_Double) ? ImGuiInputTextFlags_CharsScientific : ImGuiInputTextFlags_CharsDecimal);
bool text_value_changed = InputTextEx(label, buf, IM_ARRAYSIZE(buf), aabb.GetSize(), flags);
if (g.ScalarAsInputTextId == 0) // First frame we started displaying the InputText widget
{
IM_ASSERT(g.ActiveId == id); // InputText ID expected to match the Slider ID (else we'd need to store them both, which is also possible)

Loading…
Cancel
Save