]> git.sesse.net Git - vlc/commitdiff
* all: fixed a bug occuring when a slider was resized (the thickness
authorCyril Deguet <asmax@videolan.org>
Tue, 15 Nov 2005 22:30:17 +0000 (22:30 +0000)
committerCyril Deguet <asmax@videolan.org>
Tue, 15 Nov 2005 22:30:17 +0000 (22:30 +0000)
 of the slider background was proportional to the scaling factor,
 which is not what we want!)

modules/gui/skins2/controls/ctrl_slider.cpp
modules/gui/skins2/utils/bezier.cpp
modules/gui/skins2/utils/bezier.hpp

index 08adabbaf22d91664df7a7ace8a61d87129f22ca..641738fb02ab492987c52684079b1f6a7fb237d5 100644 (file)
@@ -377,8 +377,8 @@ bool CtrlSliderBg::mouseOver( int x, int y ) const
     float factorX, factorY;
     getResizeFactors( factorX, factorY );
 
-    return (m_rCurve.getMinDist( (int)(x / factorX),
-                                 (int)(y / factorY) ) < m_thickness );
+    return (m_rCurve.getMinDist( (int)(x / factorX), (int)(y / factorY),
+                                 factorX, factorY ) < m_thickness );
 }
 
 
index 5d2b83b0604c04c110fa45320f7ee4491f0a2d88..abd5df75f4bef7c2b2341f4fa62172de2d909bea 100644 (file)
@@ -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 );
-    return sqrt( (double)((m_leftVect[nearest] - x) * (m_leftVect[nearest] - x) +
-                 (m_topVect[nearest] - y) * (m_topVect[nearest] - y)) );
+    double xDist = xScale * (m_leftVect[nearest] - x);
+    double yDist = yScale * (m_topVect[nearest] - y);
+    return sqrt( xDist * xDist + yDist * yDist );
 }
 
 
index d7bda7609f452bf52bfb3c2bc26d98f22c462637..2657e3d96aa62baddedc95526f769783018f3c6b 100644 (file)
@@ -58,8 +58,10 @@ class Bezier: public SkinObject
         /// from (x, y)
         float getNearestPercent( int x, int y ) const;
 
-        /// Return the distance of (x, y) to the curve
-        float getMinDist( int x, int y ) const;
+        /// Return the distance of (x, y) to the curve, corrected
+        /// 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
         /// the curve (t must be between 0 and 1)