MCPcopy Create free account
hub / github.com/Wemino/MarkerPatch / DragFloatRange2

Method DragFloatRange2

include/imgui/imgui_widgets.cpp:2865–2895  ·  view source on GitHub ↗

NB: You likely want to specify the ImGuiSliderFlags_AlwaysClamp when using this.

Source from the content-addressed store, hash-verified

2863
2864// NB: You likely want to specify the ImGuiSliderFlags_AlwaysClamp when using this.
2865bool ImGui::DragFloatRange2(const char* label, float* v_current_min, float* v_current_max, float v_speed, float v_min, float v_max, const char* format, const char* format_max, ImGuiSliderFlags flags)
2866{
2867 ImGuiWindow* window = GetCurrentWindow();
2868 if (window->SkipItems)
2869 return false;
2870
2871 ImGuiContext& g = *GImGui;
2872 PushID(label);
2873 BeginGroup();
2874 PushMultiItemsWidths(2, CalcItemWidth());
2875
2876 float min_min = (v_min >= v_max) ? -FLT_MAX : v_min;
2877 float min_max = (v_min >= v_max) ? *v_current_max : ImMin(v_max, *v_current_max);
2878 ImGuiSliderFlags min_flags = flags | ((min_min == min_max) ? ImGuiSliderFlags_ReadOnly : 0);
2879 bool value_changed = DragScalar("##min", ImGuiDataType_Float, v_current_min, v_speed, &min_min, &min_max, format, min_flags);
2880 PopItemWidth();
2881 SameLine(0, g.Style.ItemInnerSpacing.x);
2882
2883 float max_min = (v_min >= v_max) ? *v_current_min : ImMax(v_min, *v_current_min);
2884 float max_max = (v_min >= v_max) ? FLT_MAX : v_max;
2885 ImGuiSliderFlags max_flags = flags | ((max_min == max_max) ? ImGuiSliderFlags_ReadOnly : 0);
2886 value_changed |= DragScalar("##max", ImGuiDataType_Float, v_current_max, v_speed, &max_min, &max_max, format_max ? format_max : format, max_flags);
2887 PopItemWidth();
2888 SameLine(0, g.Style.ItemInnerSpacing.x);
2889
2890 TextEx(label, FindRenderedTextEnd(label));
2891 EndGroup();
2892 PopID();
2893
2894 return value_changed;
2895}
2896
2897// NB: v_speed is float to allow adjusting the drag speed with more precision
2898bool ImGui::DragInt(const char* label, int* v, float v_speed, int v_min, int v_max, const char* format, ImGuiSliderFlags flags)

Callers

nothing calls this directly

Calls 3

GetCurrentWindowFunction · 0.85
ImMinFunction · 0.85
ImMaxFunction · 0.85

Tested by

no test coverage detected