2
0
Эх сурвалжийг харах

Fix DragScalar for unsigned types (#2780)
decreasing the value was broken on arm64

Bagrat Dabaghyan 6 жил өмнө
parent
commit
3cf519c9cb

+ 1 - 0
docs/CHANGELOG.txt

@@ -46,6 +46,7 @@ Other Changes:
   Individuals tabs are given integer-rounded width and remainder is spread between tabs left-to-right.
 - SliderScalar: Improved assert when using U32 or U64 types with a large v_max value. (#2765) [@loicmouton]
 - DragInt, DragFloat, DragScalar: Using (v_min > v_max) allows locking any edit to the value.
+- DragScalar: Fixed dragging of unsigned values on ARM cpu. (#2780) [@dBagrat]
 - ImDrawList: clarified the name of many parameters so reading the code is a little easier. (#2740)
 - Using offsetof() when available in C++11. Avoids Clang sanitizer complaining about old-style macros. (#94)
 - Added a mechanism to compact/free the larger allocations of unused windows (buffers are compacted when

+ 2 - 2
imgui_widgets.cpp

@@ -1975,12 +1975,12 @@ bool ImGui::DragBehaviorT(ImGuiDataType data_type, TYPE* v, float v_speed, const
         // Offset + round to user desired precision, with a curve on the v_min..v_max range to get more precision on one side of the range
         FLOATTYPE v_old_norm_curved = ImPow((FLOATTYPE)(v_cur - v_min) / (FLOATTYPE)(v_max - v_min), (FLOATTYPE)1.0f / power);
         FLOATTYPE v_new_norm_curved = v_old_norm_curved + (g.DragCurrentAccum / (v_max - v_min));
-        v_cur = v_min + (TYPE)ImPow(ImSaturate((float)v_new_norm_curved), power) * (v_max - v_min);
+        v_cur = v_min + (SIGNEDTYPE)ImPow(ImSaturate((float)v_new_norm_curved), power) * (v_max - v_min);
         v_old_ref_for_accum_remainder = v_old_norm_curved;
     }
     else
     {
-        v_cur += (TYPE)g.DragCurrentAccum;
+        v_cur += (SIGNEDTYPE)g.DragCurrentAccum;
     }
 
     // Round to user desired precision based on format string