Skip to content

Commit

Permalink
change draw order to enable enum draw for 0-1 values
Browse files Browse the repository at this point in the history
  • Loading branch information
Nir-Az committed Oct 2, 2022
1 parent edf6f5e commit 90d6060
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions common/model-views.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -585,19 +585,19 @@ namespace rs2
if (!new_line)
ImGui::SameLine();

if (is_checkbox())
if ( is_enum() )
{
res = draw_checkbox( model, error_message, desc );
res = draw_combobox( model, error_message, desc, new_line, use_option_name );
}
else
{
if( !is_enum() )
if( is_checkbox() )
{
res = draw_slider( model, error_message, desc, use_cm_units );
res = draw_checkbox( model, error_message, desc );
}
else
{
res = draw_combobox( model, error_message, desc, new_line, use_option_name );
res = draw_slider( model, error_message, desc, use_cm_units );
}
}

Expand Down Expand Up @@ -693,7 +693,9 @@ namespace rs2

bool option_model::is_enum() const
{
if (range.step < 0.001f) return false;
// We do not expect enum values to have a step that is smaller than 1,
// and we don't want to compare a floating point value to an integer so 0.9 will do the work.
if (range.step < 0.9f) return false;

for (auto i = range.min; i <= range.max; i += range.step)
{
Expand Down

0 comments on commit 90d6060

Please sign in to comment.