Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DragFloat/Double with min/max and power #1823

Closed
Ghost-yc opened this issue May 17, 2018 · 3 comments
Closed

DragFloat/Double with min/max and power #1823

Ghost-yc opened this issue May 17, 2018 · 3 comments

Comments

@Ghost-yc
Copy link

Hi! When i use dragfloat function with
ImGui::DragFloat3("Position", pos.data, .1f, -FLT_MAX, FLT_MAX, "%.1f", 1.25f)
mouse gently move the value changed huge

imgui version: v1.61

@ocornut ocornut added bug and removed bug labels May 17, 2018
@ocornut
Copy link
Owner

ocornut commented May 17, 2018

Hello,

Previously the power curve was incorrectly computed for DragFloat() and it was difficult to make it works with different data type. It's now reliant on the min/max range, and unfortunately if you use power != 0.0 it will use v_max-v_min and land on numerical precision issues here.

I'm not sure what to say. It is a regression but allowing it may be tricky. If you use power curves you need a range like SliderFloat. I'll have to see if it affects many users..

@Ghost-yc
Copy link
Author

ok thanks

@ocornut ocornut changed the title about dragfloat/double min max and power DragFloat/Double with min/max and power May 19, 2018
ocornut pushed a commit that referenced this issue Aug 17, 2020
ocornut pushed a commit that referenced this issue Aug 17, 2020
ocornut added a commit that referenced this issue Aug 17, 2020
ocornut added a commit that referenced this issue Aug 17, 2020
…rough if power=1.0f, otherwise assert + safe fallback. Remove 3 redirection functions (#3361, #1823, #1316, #642)
ocornut pushed a commit that referenced this issue Aug 17, 2020
@ocornut
Copy link
Owner

ocornut commented Aug 17, 2020

@Ghost-yc we have now made changes to add a ImGuiSliderFlags_Logarithmic flag instead of power (see #3361).

While it is a little akward, logarithmic drag and sliders cannot be used without bounds, you can however use, e.g.

ImGui::SliderFloat("Position", &f2, -1000000.0f, +1000000.0f, "%.6f", ImGuiSliderFlags_Logarithmic);

@ocornut ocornut closed this as completed Aug 17, 2020
ocornut added a commit that referenced this issue Aug 18, 2020
…, #1823, #1316, #642, #1829, #3209)

Technically API breaking (but ImGuiDragFlags were pushed on master 16 hours ago)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants