[gnome-shell] slider: Calculate handle position in whole pixel units



commit 38da479ee8378c17947cbad802aef8f169364590
Author: Daniel van Vugt <daniel van vugt canonical com>
Date:   Thu Feb 20 16:02:20 2020 +0800

    slider: Calculate handle position in whole pixel units
    
    `-slider-handle-radius` is a floating point value and even in the default
    theme it's not a whole number. Regardless of the fractional part that's
    still going to occupy a whole extra pixel with antialiasing. So make room
    for it. Otherwise it looks clipped, which it is by the Cairo context of
    its `StDrawingArea`.
    
    Fixes https://gitlab.gnome.org/GNOME/gnome-shell/issues/1569

 js/ui/slider.js | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/js/ui/slider.js b/js/ui/slider.js
index 824cf87555..01b29e1fc2 100644
--- a/js/ui/slider.js
+++ b/js/ui/slider.js
@@ -43,7 +43,9 @@ var Slider = GObject.registerClass({
         let [hasHandleColor, handleBorderColor] =
             themeNode.lookup_color('-slider-handle-border-color', false);
 
-        let handleX = handleRadius + (width - 2 * handleRadius) * this._value / this._maxValue;
+        let wholeHandleRadius = Math.ceil(handleRadius);
+        let handleX = wholeHandleRadius +
+            (width - 2 * wholeHandleRadius) * this._value / this._maxValue;
         let handleY = height / 2;
 
         let color = themeNode.get_foreground_color();


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]