mirror of
https://github.com/Drezil/imgui.git
synced 2025-03-31 00:12:44 +00:00
DragFloat: Disabled using power curve when one edge is FLT_MAX (broken in 1.61). Disabled setting a default drag speed when one edge is FLT_MAX. (#2024)
This commit is contained in:
parent
af6cf25255
commit
d014d0285a
@ -43,6 +43,8 @@ Other Changes:
|
|||||||
properly after the main menu bar or last focused window is deactivated.
|
properly after the main menu bar or last focused window is deactivated.
|
||||||
- DragFloat: Fixed a situation where dragging with value rounding enabled or with a power curve
|
- DragFloat: Fixed a situation where dragging with value rounding enabled or with a power curve
|
||||||
erroneously wrapped the value to one of the min/max edge. (#2024, #708, #320, #2075).
|
erroneously wrapped the value to one of the min/max edge. (#2024, #708, #320, #2075).
|
||||||
|
- DragFloat: Disabled using power curve when one edge is FLT_MAX (broken in 1.61). (#2024)
|
||||||
|
- DragFloat: Disabled setting a default drag speed when one edge is FLT_MAX. (#2024)
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
|
@ -2477,8 +2477,8 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
|
|||||||
ImGui::Checkbox("Anti-aliased lines", &style.AntiAliasedLines); ImGui::SameLine(); ShowHelpMarker("When disabling anti-aliasing lines, you'll probably want to disable borders in your style as well.");
|
ImGui::Checkbox("Anti-aliased lines", &style.AntiAliasedLines); ImGui::SameLine(); ShowHelpMarker("When disabling anti-aliasing lines, you'll probably want to disable borders in your style as well.");
|
||||||
ImGui::Checkbox("Anti-aliased fill", &style.AntiAliasedFill);
|
ImGui::Checkbox("Anti-aliased fill", &style.AntiAliasedFill);
|
||||||
ImGui::PushItemWidth(100);
|
ImGui::PushItemWidth(100);
|
||||||
ImGui::DragFloat("Curve Tessellation Tolerance", &style.CurveTessellationTol, 0.02f, 0.10f, FLT_MAX, NULL, 2.0f);
|
ImGui::DragFloat("Curve Tessellation Tolerance", &style.CurveTessellationTol, 0.02f, 0.10f, FLT_MAX, "%.2f", 2.0f);
|
||||||
if (style.CurveTessellationTol < 0.0f) style.CurveTessellationTol = 0.10f;
|
if (style.CurveTessellationTol < 0.10f) style.CurveTessellationTol = 0.10f;
|
||||||
ImGui::DragFloat("Global Alpha", &style.Alpha, 0.005f, 0.20f, 1.0f, "%.2f"); // Not exposing zero here so user doesn't "lose" the UI (zero alpha clips all widgets). But application code could have a toggle to switch between zero and non-zero.
|
ImGui::DragFloat("Global Alpha", &style.Alpha, 0.005f, 0.20f, 1.0f, "%.2f"); // Not exposing zero here so user doesn't "lose" the UI (zero alpha clips all widgets). But application code could have a toggle to switch between zero and non-zero.
|
||||||
ImGui::PopItemWidth();
|
ImGui::PopItemWidth();
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
|
@ -1709,10 +1709,10 @@ bool ImGui::DragBehaviorT(ImGuiDataType data_type, TYPE* v, float v_speed, const
|
|||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
const bool is_decimal = (data_type == ImGuiDataType_Float) || (data_type == ImGuiDataType_Double);
|
const bool is_decimal = (data_type == ImGuiDataType_Float) || (data_type == ImGuiDataType_Double);
|
||||||
const bool has_min_max = (v_min != v_max) && (v_max - v_max < FLT_MAX);
|
const bool has_min_max = (v_min != v_max);
|
||||||
|
|
||||||
// Default tweak speed
|
// Default tweak speed
|
||||||
if (v_speed == 0.0f && has_min_max)
|
if (v_speed == 0.0f && has_min_max && (v_max - v_min < FLT_MAX))
|
||||||
v_speed = (float)((v_max - v_min) * g.DragSpeedDefaultRatio);
|
v_speed = (float)((v_max - v_min) * g.DragSpeedDefaultRatio);
|
||||||
|
|
||||||
// Inputs accumulates into g.DragCurrentAccum, which is flushed into the current value as soon as it makes a difference with our precision settings
|
// Inputs accumulates into g.DragCurrentAccum, which is flushed into the current value as soon as it makes a difference with our precision settings
|
||||||
@ -1754,7 +1754,7 @@ bool ImGui::DragBehaviorT(ImGuiDataType data_type, TYPE* v, float v_speed, const
|
|||||||
TYPE v_cur = *v;
|
TYPE v_cur = *v;
|
||||||
FLOATTYPE v_old_ref_for_accum_remainder = (FLOATTYPE)0.0f;
|
FLOATTYPE v_old_ref_for_accum_remainder = (FLOATTYPE)0.0f;
|
||||||
|
|
||||||
const bool is_power = (power != 1.0f && is_decimal && has_min_max);
|
const bool is_power = (power != 1.0f && is_decimal && has_min_max && (v_max - v_min < FLT_MAX));
|
||||||
if (is_power)
|
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
|
// 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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user