From 1e8203d8b0e1a75d8dbfa643dd29a0276c89abac Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Sun, 18 Oct 2026 14:54:37 +0200 Subject: fix(weather cards): arrowhead needle, matched type sizes, visible rain bars - details: the wind needle ends in a filled arrowhead instead of a dot, so the direction it points (where the wind goes) reads one way only. - hourly, details, sky: raise each card's share so card.standard reaches the same S (72) as now and week. Title and row text now match across the five cards (21.6px / 23px), in line with breaktimer and calendar. The bands (curve, compass, arc) absorb what is left. - hourly: band labels follow the band height a little more (capped at the row size), so they do not shrink with the taller header. - hourly: rain-chance bars at half alpha with a minimum height for any nonzero chance. Typical chances are a few percent, which scaled honestly is a 1px bar that no alpha can rescue. - now: the condition line sits on the card's foot, so the height the capped type leaves over is not an empty strip at the bottom. Co-Authored-By: Claude Opus 5.5 --- widgets/details.lua | 18 ++++++++++++------ widgets/hourly.lua | 13 ++++++++----- widgets/now.lua | 9 ++++++--- widgets/sky.lua | 2 +- 4 files changed, 27 insertions(+), 15 deletions(-) diff --git a/widgets/details.lua b/widgets/details.lua index 8b107a9..45f2f3d 100644 --- a/widgets/details.lua +++ b/widgets/details.lua @@ -33,14 +33,20 @@ local function draw_compass(cr, x, y, w, h, colors, deg, S) -- Open-Meteo gives where the wind comes FROM; the needle points where it goes. local a = math.rad(deg + 180) local tip = r - size * 2 - local tx, ty = cx + tip * math.sin(a), cy - tip * math.cos(a) + local sa, ca = math.sin(a), math.cos(a) + -- A filled arrowhead at the tip, so the needle reads one way only. The shaft + -- stops at the head's base: a stroke run to the apex would blunt it. + local head, half = r * 0.22, r * 0.11 + local bx, by = cx + (tip - head) * sa, cy - (tip - head) * ca card.rgba(cr, colors.highlight) cairo_set_line_width(cr, math.max(2, r * 0.04)) - cairo_move_to(cr, cx - tip * 0.6 * math.sin(a), cy + tip * 0.6 * math.cos(a)) - cairo_line_to(cr, tx, ty) + cairo_move_to(cr, cx - tip * 0.6 * sa, cy + tip * 0.6 * ca) + cairo_line_to(cr, bx, by) cairo_stroke(cr) - cairo_new_path(cr) - cairo_arc(cr, tx, ty, math.max(3, r * 0.06), 0, math.pi * 2) + cairo_move_to(cr, cx + tip * sa, cy - tip * ca) + cairo_line_to(cr, bx + half * ca, by + half * sa) + cairo_line_to(cr, bx - half * ca, by - half * sa) + cairo_close_path(cr) cairo_fill(cr) end @@ -69,7 +75,7 @@ function M.draw(cr, rect, colors) { 'AIR (EAQI)', weather.num(aqi), colors[weather.aqi_role(aqi)] }, } local y, S = card.standard(cr, inner, colors, { - icon = card.ICON.details, title = 'DETAILS', rows = rows, share = 0.6, + icon = card.ICON.details, title = 'DETAILS', rows = rows, share = 0.8, }) draw_compass(cr, inner.x, y, inner.w, inner.y + inner.h - y, colors, c.wind_deg, S) end diff --git a/widgets/hourly.lua b/widgets/hourly.lua index 82f7585..dfcc64d 100644 --- a/widgets/hourly.lua +++ b/widgets/hourly.lua @@ -13,7 +13,7 @@ local M = {} -- Every third hour is labelled; all 24 shape the curve. local function draw_curve(cr, x, y, w, h, colors, hours, S) local n = math.min(#hours, 24) - local label = math.max(9, math.min(h * 0.11, w / 8 * 0.22)) + local label = math.max(9, math.min(h * 0.135, w / 8 * 0.22, S * 0.32)) local glyph = label * 1.5 local slot = w / n local function px(i) return x + (i - 0.5) * slot end @@ -31,12 +31,15 @@ local function draw_curve(cr, x, y, w, h, colors, hours, S) local span = math.max(hi - lo, 1) local function py(t) return base - (base - top) * (0.15 + 0.7 * (t - lo) / span) end - -- Rain chance as bars rising from the baseline, under the curve. - card.rgba(cr, colors.value, 0.3) + -- Rain chance as bars rising from the baseline, under the curve. Typical + -- chances are a few percent, which scaled honestly is a 1px bar no alpha can + -- rescue, so any nonzero chance gets a floor; the half alpha keeps the bars + -- a backdrop to the full-strength curve. + card.rgba(cr, colors.value, 0.5) for i = 1, n do local p = math.min(hours[i].precip or 0, 100) if p > 0 then - local bh = (base - top) * 0.5 * p / 100 + local bh = math.max((base - top) * 0.5 * p / 100, label * 0.4) cairo_rectangle(cr, px(i) - slot * 0.3, base - bh, slot * 0.6, bh) end end @@ -88,7 +91,7 @@ function M.draw(cr, rect, colors) -- hours[1] is the current hour, so the big value is the one after it. local y, S = card.standard(cr, inner, colors, { icon = card.ICON.hourly, title = 'NEXT 24H', - big = weather.deg((w.hours[2] or {}).temp), share = 0.4, + big = weather.deg((w.hours[2] or {}).temp), share = 0.56, }) draw_curve(cr, inner.x, y, inner.w, inner.y + inner.h - y, colors, w.hours, S) end diff --git a/widgets/now.lua b/widgets/now.lua index 1b797ae..6273ed1 100644 --- a/widgets/now.lua +++ b/widgets/now.lua @@ -31,12 +31,15 @@ function M.draw(cr, rect, colors) big = weather.deg(c.temp), rows = rows, share = 0.85, }) - -- The condition in words, in the prose face, in what the rows left. + -- The condition in words, in the prose face, in what the rows left. It sits + -- on the card's foot: the type is capped to match the other cards, so a tall + -- cell leaves height over, and that gap belongs above the line, not below. local size = S * 0.36 - if y + size * 1.4 <= inner.y + inner.h then + local foot = inner.y + inner.h - size * 0.25 + if y + size * 1.4 <= foot then card.font(cr, card.FONT_UI, size, false) card.rgba(cr, colors.body) - card.text(cr, inner.x, y + size * 1.4, weather.describe(c.code)) + card.text(cr, inner.x, foot, weather.describe(c.code)) end end diff --git a/widgets/sky.lua b/widgets/sky.lua index 7dbc399..9bfc1d1 100644 --- a/widgets/sky.lua +++ b/widgets/sky.lua @@ -72,7 +72,7 @@ function M.draw(cr, rect, colors) local y = card.standard(cr, inner, colors, { icon = card.ICON.sky, title = 'SKY', big = weather.moon_icon(phase), big_font = card.FONT_MONO, - big_color = colors.heading, rows = rows, share = 0.65, + big_color = colors.heading, rows = rows, share = 0.94, }) -- An arch taller than about 0.6 of its width reads as a door, not a day. -- cgit v1.2.3