[gnome-weather] ui: Always draw scale top and bottom radiuses



commit 504ba8f202da99f0b809e32ec0a11d461a5eb187
Author: Vitaly Dyachkov <obyknovenius me com>
Date:   Tue May 31 17:58:15 2022 +0200

    ui: Always draw scale top and bottom radiuses
    
    When the highest and the lowest day temperature are equal we currently
    end up not rendering the scale at all.
    
    This change makes sure that we always render top and bottom scale
    radiuses, effectively showing at least a dot.

 src/app/thermometer.js | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/src/app/thermometer.js b/src/app/thermometer.js
index d040378..9605ed6 100644
--- a/src/app/thermometer.js
+++ b/src/app/thermometer.js
@@ -90,17 +90,17 @@ GObject.registerClass({
 
     const { dailyHigh, dailyLow, weeklyHigh, weeklyLow } = this.range;
 
-    const scaleFactor = height / (weeklyHigh - weeklyLow);
+    const scaleRadius = 12;
+    const scaleFactor = (height - scaleRadius * 2) / (weeklyHigh - weeklyLow);
 
     const scaleWidth = 24;
     const scaleHeight = scaleFactor * (dailyHigh - dailyLow);
-    const scaleRadius = 12;
 
     const x = (width - scaleWidth) / 2;
-    const y = scaleFactor * (weeklyHigh - dailyHigh);
+    const y = scaleRadius + scaleFactor * (weeklyHigh - dailyHigh);
 
     const bounds = new Graphene.Rect();
-    bounds.init(x, y, scaleWidth, scaleHeight);
+    bounds.init(x, y - scaleRadius, scaleWidth, scaleHeight + 2 * scaleRadius);
 
     const outline = new Gsk.RoundedRect();
     outline.init_from_rect(bounds, scaleRadius);


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