mirror of https://github.com/axmolengine/axmol.git
Update extensions/GUI/CCControlExtension/CCControlSlider.cpp
This commit is contained in:
parent
da819e1109
commit
a4d2d317b5
|
@ -236,7 +236,7 @@ void CCControlSlider::sliderEnded(CCPoint location)
|
||||||
float CCControlSlider::valueForLocation(CCPoint location)
|
float CCControlSlider::valueForLocation(CCPoint location)
|
||||||
{
|
{
|
||||||
float percent = (location.x-SLIDER_MARGIN_H)/ m_backgroundSprite->getContentSize().width;
|
float percent = (location.x-SLIDER_MARGIN_H)/ m_backgroundSprite->getContentSize().width;
|
||||||
return max(min(m_minimumValue + percent * (m_maximumValue - m_minimumValue), m_maximumAllowedValue), m_minimumAllowedValue);
|
return MAX(MIN(m_minimumValue + percent * (m_maximumValue - m_minimumValue), m_maximumAllowedValue), m_minimumAllowedValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_CC_EXT_END
|
NS_CC_EXT_END
|
||||||
|
|
Loading…
Reference in New Issue