Commit f8fad963 authored by Cyril Deguet's avatar Cyril Deguet

* all: fixed a bug occuring when a slider was resized (the thickness

 of the slider background was proportional to the scaling factor,
 which is not what we want!)
parent 8753c93a
...@@ -377,8 +377,8 @@ bool CtrlSliderBg::mouseOver( int x, int y ) const ...@@ -377,8 +377,8 @@ bool CtrlSliderBg::mouseOver( int x, int y ) const
float factorX, factorY; float factorX, factorY;
getResizeFactors( factorX, factorY ); getResizeFactors( factorX, factorY );
return (m_rCurve.getMinDist( (int)(x / factorX), return (m_rCurve.getMinDist( (int)(x / factorX), (int)(y / factorY),
(int)(y / factorY) ) < m_thickness ); factorX, factorY ) < m_thickness );
} }
......
...@@ -107,11 +107,12 @@ float Bezier::getNearestPercent( int x, int y ) const ...@@ -107,11 +107,12 @@ float Bezier::getNearestPercent( int x, int y ) const
} }
float Bezier::getMinDist( int x, int y ) const float Bezier::getMinDist( int x, int y, float xScale, float yScale ) const
{ {
int nearest = findNearestPoint( x, y ); int nearest = findNearestPoint( x, y );
return sqrt( (double)((m_leftVect[nearest] - x) * (m_leftVect[nearest] - x) + double xDist = xScale * (m_leftVect[nearest] - x);
(m_topVect[nearest] - y) * (m_topVect[nearest] - y)) ); double yDist = yScale * (m_topVect[nearest] - y);
return sqrt( xDist * xDist + yDist * yDist );
} }
......
...@@ -58,8 +58,10 @@ class Bezier: public SkinObject ...@@ -58,8 +58,10 @@ class Bezier: public SkinObject
/// from (x, y) /// from (x, y)
float getNearestPercent( int x, int y ) const; float getNearestPercent( int x, int y ) const;
/// Return the distance of (x, y) to the curve /// Return the distance of (x, y) to the curve, corrected
float getMinDist( int x, int y ) const; /// by the (optional) given scale factors
float getMinDist( int x, int y, float xScale = 1.0f,
float yScale = 1.0f ) const;
/// Get the coordinates of the point at t percent of /// Get the coordinates of the point at t percent of
/// the curve (t must be between 0 and 1) /// the curve (t must be between 0 and 1)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment