|
|
@ -1942,7 +1942,7 @@ static bool DataTypeClampT(T* v, const T* v_min, const T* v_max)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Clamp, both sides are optional, return true if modified
|
|
|
|
// Clamp, both sides are optional, return true if modified
|
|
|
|
if (v_min && *v < *v_min) { *v = *v_min; return true; }
|
|
|
|
if (v_min && *v < *v_min) { *v = *v_min; return true; }
|
|
|
|
if (v_max && *v > * v_max) { *v = *v_max; return true; }
|
|
|
|
if (v_max && *v > *v_max) { *v = *v_max; return true; }
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -3191,7 +3191,11 @@ bool ImGui::TempInputScalar(const ImRect& bb, ImGuiID id, const char* label, ImG
|
|
|
|
// Apply new value (or operations) then clamp
|
|
|
|
// Apply new value (or operations) then clamp
|
|
|
|
DataTypeApplyOpFromText(data_buf, g.InputTextState.InitialTextA.Data, data_type, p_data, NULL);
|
|
|
|
DataTypeApplyOpFromText(data_buf, g.InputTextState.InitialTextA.Data, data_type, p_data, NULL);
|
|
|
|
if (p_clamp_min || p_clamp_max)
|
|
|
|
if (p_clamp_min || p_clamp_max)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (DataTypeCompare(data_type, p_clamp_min, p_clamp_max) > 0)
|
|
|
|
|
|
|
|
ImSwap(p_clamp_min, p_clamp_max);
|
|
|
|
DataTypeClamp(data_type, p_data, p_clamp_min, p_clamp_max);
|
|
|
|
DataTypeClamp(data_type, p_data, p_clamp_min, p_clamp_max);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Only mark as edited if new value is different
|
|
|
|
// Only mark as edited if new value is different
|
|
|
|
value_changed = memcmp(&data_backup, p_data, data_type_size) != 0;
|
|
|
|
value_changed = memcmp(&data_backup, p_data, data_type_size) != 0;
|
|
|
|