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
This commit is contained in:
Daniel van Vugt 2020-02-20 16:02:20 +08:00
parent 574ab04e9f
commit 38da479ee8

View File

@ -43,7 +43,9 @@ var Slider = GObject.registerClass({
let [hasHandleColor, handleBorderColor] = let [hasHandleColor, handleBorderColor] =
themeNode.lookup_color('-slider-handle-border-color', false); 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 handleY = height / 2;
let color = themeNode.get_foreground_color(); let color = themeNode.get_foreground_color();