Skip to content

Commit

Permalink
Added support in setting negative float values in realsense_viewer
Browse files Browse the repository at this point in the history
  • Loading branch information
belkinirena authored Jun 28, 2018
1 parent 882aeee commit 86b3db1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions common/model-views.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -563,9 +563,12 @@ namespace rs2
if (ImGui::SliderFloat(id.c_str(), &value,
range.min, range.max, "%.4f"))
{
auto loffset = fmod(value, range.step);
auto loffset = std::abs(fmod(value, range.step));
auto roffset = range.step - loffset;
value = (loffset < roffset) ? value - loffset : value + roffset;
if (value >= 0)
value = (loffset < roffset) ? value - loffset : value + roffset;
else
value = (loffset < roffset) ? value + loffset : value - roffset;
value = (value < range.min) ? range.min : value;
value = (value > range.max) ? range.max : value;
model.add_log(to_string() << "Setting " << opt << " to " << value);
Expand Down

0 comments on commit 86b3db1

Please sign in to comment.