diff options
Diffstat (limited to 'widgets')
| -rw-r--r-- | widgets/weather.lua | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/widgets/weather.lua b/widgets/weather.lua index 4882a4c..50d0e10 100644 --- a/widgets/weather.lua +++ b/widgets/weather.lua @@ -185,24 +185,18 @@ function M.draw(cr, rect, colors) sy = sy + row_step end - -- The arc follows the stats rather than being pinned to the bottom, and - -- takes the smaller of its natural height and whatever remains. Pinning it - -- low left a dead band between the stats and the curve; the layout gives - -- this widget a cell sized to its content, so the drawing should end where - -- the content does. + -- The arc takes what is genuinely left below the stats, with no minimum: a + -- floor here meant a short cell pulled the curve up THROUGH the stat rows, + -- drawing the sunrise time over the word WIND. Below the height where it + -- can be read it is dropped entirely, because no arc beats a broken one. + -- This is what lets one widget sit in a 2x2 or a 2x3 cell unchanged. local bottom = inner.y + inner.h - local arc_h = clamp(inner.h * 0.34, 110, 240) - local arc_y = math.min(sy + row_step * 0.6, bottom - arc_h) - - -- Rule above the arc, riding with it rather than with the stats: it reads as - -- the arc band's top edge, and the gap left by a tall card falls here. - local ry2 = arc_y - 14 - card.rgba(cr, colors.rule, 0.8) - cairo_move_to(cr, inner.x, ry2) - cairo_line_to(cr, inner.x + inner.w, ry2) - cairo_stroke(cr) - - draw_arc(cr, inner.x, arc_y, inner.w, arc_h, colors, w, now) + local arc_y = sy + row_step * 0.6 + local arc_h = math.min(bottom - arc_y, inner.h * 0.34, 240) + if arc_h >= 70 then + draw_arc(cr, inner.x, arc_y, inner.w, arc_h, colors, w, now) + end end + return M |
