MCPcopy Create free account
hub / github.com/Aegel5/SimpleSwitcher / TempInputIsClampEnabled

Function TempInputIsClampEnabled

imgui_tiny_app/imgui/imgui_widgets.cpp:2692–2703  ·  view source on GitHub ↗

Only clamp Ctrl+Click input when ImGuiSliderFlags_ClampOnInput is set (generally via ImGuiSliderFlags_AlwaysClamp)

Source from the content-addressed store, hash-verified

2690
2691// Only clamp Ctrl+Click input when ImGuiSliderFlags_ClampOnInput is set (generally via ImGuiSliderFlags_AlwaysClamp)
2692static bool TempInputIsClampEnabled(ImGuiSliderFlags flags, ImGuiDataType data_type, const void* p_min, const void* p_max)
2693{
2694 if ((flags & ImGuiSliderFlags_ClampOnInput) && (p_min != NULL || p_max != NULL))
2695 {
2696 const int clamp_range_dir = (p_min != NULL && p_max != NULL) ? ImGui::DataTypeCompare(data_type, p_min, p_max) : 0; // -1 when *p_min < *p_max, == 0 when *p_min == *p_max
2697 if (p_min == NULL || p_max == NULL || clamp_range_dir < 0)
2698 return true;
2699 if (clamp_range_dir == 0)
2700 return ImGui::DataTypeIsZero(data_type, p_min) ? ((flags & ImGuiSliderFlags_ClampZeroRange) != 0) : true;
2701 }
2702 return false;
2703}
2704
2705// Note: p_data, p_min and p_max are _pointers_ to a memory address holding the data. For a Drag widget, p_min and p_max are optional.
2706// Read code of e.g. DragFloat(), DragInt() etc. or examples in 'Demo->Widgets->Data Types' to understand how to use this function directly.

Callers 1

DragScalarMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected