diff options
Diffstat (limited to 'widgets/details.lua')
| -rw-r--r-- | widgets/details.lua | 18 |
1 files changed, 12 insertions, 6 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 |
