Removed limitation that slider maximum could not be negative

0.8
Bruno Van de Velde 2017-08-27 18:56:54 +02:00
parent fa3528b9e6
commit cf5906e681
1 changed files with 2 additions and 5 deletions

View File

@ -202,10 +202,7 @@ namespace tgui
void Slider::setMaximum(int maximum)
{
// Set the new maximum
if (maximum > 0)
m_maximum = maximum;
else
m_maximum = 1;
m_maximum = maximum;
// The minimum can't be below the maximum
if (m_minimum > m_maximum)
@ -345,7 +342,7 @@ namespace tgui
if ((thumbLeft + (m_thumb.width / 2.0f) > 0) && (thumbLeft + (m_thumb.width / 2.0f) < getSize().x))
m_thumb.left = thumbLeft;
else
m_thumb.left = (getSize().x / (m_maximum - m_minimum) * (m_value - m_minimum)) - (m_thumb.width / 2.0f) ;
m_thumb.left = (getSize().x / (m_maximum - m_minimum) * (m_value - m_minimum)) - (m_thumb.width / 2.0f);
}
}
else // Normal mouse move