1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-08 14:07:35 +00:00

LibGUI: Use clamp() is various places

This commit is contained in:
Andreas Kling 2020-01-20 13:16:58 +01:00
parent b52d0afecf
commit b25210ee1b
4 changed files with 7 additions and 29 deletions

View file

@ -50,20 +50,13 @@ void GSlider::set_range(int min, int max)
return;
m_min = min;
m_max = max;
if (m_value > max)
m_value = max;
if (m_value < min)
m_value = min;
m_value = clamp(m_value, m_min, m_max);
update();
}
void GSlider::set_value(int value)
{
if (value > m_max)
value = m_max;
if (value < m_min)
value = m_min;
value = clamp(value, m_min, m_max);
if (m_value == value)
return;
m_value = value;