@ -10578,13 +10578,6 @@ bool ImGui::InputScalarEx(const char* label, ImGuiDataType data_type, void* data
ImGuiContext & g = * GImGui ;
const ImGuiStyle & style = g . Style ;
const ImVec2 label_size = CalcTextSize ( label , NULL , true ) ;
const ImVec2 button_size = ImVec2 ( GetFrameHeight ( ) , GetFrameHeight ( ) ) ;
BeginGroup ( ) ;
PushID ( label ) ;
if ( step_ptr )
PushItemWidth ( ImMax ( 1.0f , CalcItemWidth ( ) - ( button_size . x + style . ItemInnerSpacing . x ) * 2 ) ) ;
char buf [ 64 ] ;
DataTypeFormatString ( buf , IM_ARRAYSIZE ( buf ) , data_type , data_ptr , scalar_format ) ;
@ -10593,35 +10586,42 @@ bool ImGui::InputScalarEx(const char* label, ImGuiDataType data_type, void* data
if ( ( extra_flags & ( ImGuiInputTextFlags_CharsHexadecimal | ImGuiInputTextFlags_CharsScientific ) ) = = 0 )
extra_flags | = ImGuiInputTextFlags_CharsDecimal ;
extra_flags | = ImGuiInputTextFlags_AutoSelectAll ;
if ( InputText ( " " , buf , IM_ARRAYSIZE ( buf ) , extra_flags ) ) // PushId(label) + "" gives us the expected ID from outside point of view
value_changed = DataTypeApplyOpFromText ( buf , GImGui - > InputTextState . InitialText . begin ( ) , data_type , data_ptr , scalar_format ) ;
// Step buttons
if ( step_ptr )
{
const float button_size = GetFrameHeight ( ) ;
BeginGroup ( ) ; // The only purpose of the group here is to allow the caller to query item data e.g. IsItemActive()
PushID ( label ) ;
PushItemWidth ( ImMax ( 1.0f , CalcItemWidth ( ) - ( button_size + style . ItemInnerSpacing . x ) * 2 ) ) ;
if ( InputText ( " " , buf , IM_ARRAYSIZE ( buf ) , extra_flags ) ) // PushId(label) + "" gives us the expected ID from outside point of view
value_changed = DataTypeApplyOpFromText ( buf , g . InputTextState . InitialText . Data , data_type , data_ptr , scalar_format ) ;
PopItemWidth ( ) ;
// Step buttons
SameLine ( 0 , style . ItemInnerSpacing . x ) ;
if ( ButtonEx ( " - " , button_size , ImGuiButtonFlags_Repeat | ImGuiButtonFlags_DontClosePopups ) )
if ( ButtonEx ( " - " , ImVec2( button_size, button_size ) , ImGuiButtonFlags_Repeat | ImGuiButtonFlags_DontClosePopups ) )
{
DataTypeApplyOp ( data_type , ' - ' , data_ptr , data_ptr , g . IO . KeyCtrl & & step_fast_ptr ? step_fast_ptr : step_ptr ) ;
value_changed = true ;
}
SameLine ( 0 , style . ItemInnerSpacing . x ) ;
if ( ButtonEx ( " + " , button_size, ImGuiButtonFlags_Repeat | ImGuiButtonFlags_DontClosePopups ) )
if ( ButtonEx ( " + " , ImVec2( button_size, button_size ) , ImGuiButtonFlags_Repeat | ImGuiButtonFlags_DontClosePopups ) )
{
DataTypeApplyOp ( data_type , ' + ' , data_ptr , data_ptr , g . IO . KeyCtrl & & step_fast_ptr ? step_fast_ptr : step_ptr ) ;
value_changed = true ;
}
}
PopID ( ) ;
SameLine ( 0 , style . ItemInnerSpacing . x ) ;
TextUnformatted ( label , FindRenderedTextEnd ( label ) ) ;
if ( label_size . x > 0 )
PopID ( ) ;
EndGroup ( ) ;
}
else
{
SameLine ( 0 , style . ItemInnerSpacing . x ) ;
RenderText ( ImVec2 ( window - > DC . CursorPos . x , window - > DC . CursorPos . y + style . FramePadding . y ) , label ) ;
ItemSize ( label_size , style . FramePadding . y ) ;
if ( InputText ( label , buf , IM_ARRAYSIZE ( buf ) , extra_flags ) )
value_changed = DataTypeApplyOpFromText ( buf , g . InputTextState . InitialText . Data , data_type , data_ptr , scalar_format ) ;
}
EndGroup ( ) ;
return value_changed ;
}