@ -1727,6 +1727,7 @@ bool ImGui::DragBehaviorT(ImGuiDataType data_type, TYPE* v, float v_speed, const
const ImGuiAxis axis = ( flags & ImGuiDragFlags_Vertical ) ? ImGuiAxis_Y : ImGuiAxis_X ;
const bool is_decimal = ( data_type = = ImGuiDataType_Float ) | | ( data_type = = ImGuiDataType_Double ) ;
const bool has_min_max = ( v_min ! = v_max ) ;
const bool is_power = ( power ! = 1.0f & & is_decimal & & has_min_max & & ( v_max - v_min < FLT_MAX ) ) ;
// Default tweak speed
if ( v_speed = = 0.0f & & has_min_max & & ( v_max - v_min < FLT_MAX ) )
@ -1758,7 +1759,8 @@ bool ImGui::DragBehaviorT(ImGuiDataType data_type, TYPE* v, float v_speed, const
// Avoid altering values and clamping when we are _already_ past the limits and heading in the same direction, so e.g. if range is 0..255, current value is 300 and we are pushing to the right side, keep the 300.
bool is_just_activated = g . ActiveIdIsJustActivated ;
bool is_already_past_limits_and_pushing_outward = has_min_max & & ( ( * v > = v_max & & adjust_delta > 0.0f ) | | ( * v < = v_min & & adjust_delta < 0.0f ) ) ;
if ( is_just_activated | | is_already_past_limits_and_pushing_outward )
bool is_drag_direction_change_with_power = is_power & & ( ( adjust_delta < 0 & & g . DragCurrentAccum > 0 ) | | ( adjust_delta > 0 & & g . DragCurrentAccum < 0 ) ) ;
if ( is_just_activated | | is_already_past_limits_and_pushing_outward | | is_drag_direction_change_with_power )
{
g . DragCurrentAccum = 0.0f ;
g . DragCurrentAccumDirty = false ;
@ -1775,7 +1777,6 @@ bool ImGui::DragBehaviorT(ImGuiDataType data_type, TYPE* v, float v_speed, const
TYPE v_cur = * v ;
FLOATTYPE v_old_ref_for_accum_remainder = ( FLOATTYPE ) 0.0f ;
const bool is_power = ( power ! = 1.0f & & is_decimal & & has_min_max & & ( v_max - v_min < FLT_MAX ) ) ;
if ( is_power )
{
// 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