@@ -118,12 +118,11 @@ void GUISlider::Create(GUIProperties *Props)
118
118
Props->GetValue (" Minimum" , &m_Minimum);
119
119
Props->GetValue (" Maximum" , &m_Maximum);
120
120
Props->GetValue (" Value" , &m_Value);
121
- const bool gotValueRes = Props->GetValue (" ValueResolution" , &m_ValueResolution);
122
- if (!gotValueRes) {
121
+ if (!Props->GetValue (" ValueResolution" , &m_ValueResolution)) {
123
122
m_ValueResolution = std::max ((m_Maximum - m_Minimum) / 100 , 1 );
124
123
}
125
124
126
- m_Value = std::clamp (m_Value, m_Minimum,m_Maximum);
125
+ m_Value = std::clamp (m_Value, m_Minimum, m_Maximum);
127
126
128
127
// Re-Calculate the knob info
129
128
CalculateKnob ();
@@ -524,15 +523,16 @@ GUIPanel *GUISlider::GetPanel(void)
524
523
// Description: Calculates the knob position and size.
525
524
526
525
void GUISlider::CalculateKnob (void ) {
527
- if (!m_KnobImage)
526
+ if (!m_KnobImage) {
528
527
return ;
528
+ }
529
529
530
530
if (m_Maximum > m_Minimum) {
531
- const bool orientation = (m_Orientation == Horizontal);
532
- m_KnobSize = (orientation ) ? m_KnobImage->GetWidth () : m_KnobImage->GetHeight ();
533
- const int size = (orientation ) ? m_Width : m_Height;
531
+ const bool horizontalOrientation = (m_Orientation == Horizontal);
532
+ m_KnobSize = (horizontalOrientation ) ? m_KnobImage->GetWidth () : m_KnobImage->GetHeight ();
533
+ const int size = (horizontalOrientation ) ? m_Width : m_Height;
534
534
const float valueRatio = static_cast <float >(m_Value - m_Minimum) / static_cast <float >(m_Maximum - m_Minimum);
535
- m_KnobPosition = m_EndThickness + static_cast <int >(static_cast <float >(size - m_KnobSize - 2 * m_EndThickness ) * valueRatio);
535
+ m_KnobPosition = m_EndThickness + static_cast <int >(static_cast <float >(size - m_KnobSize - (m_EndThickness * 2 ) ) * valueRatio);
536
536
}
537
537
}
538
538
0 commit comments