commit c53120ab2ae26add2126ff2812d14c9a29313b2a parent e728052bb6cb97f80670d5662294ea0b5788424d Author: Daniel Barlow <dan@telent.net> Date: Wed, 4 Jun 2025 00:14:43 +0100 print fewer upside down road labels Diffstat:
| M | pkgs/maps/main.fnl | | | 14 | ++++++++++---- |
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/pkgs/maps/main.fnl b/pkgs/maps/main.fnl @@ -122,10 +122,16 @@ label.readout { (let [[x y] (. points biggest-n) [nx ny] (. points (+ 1 biggest-n)) angle (math.atan (- ny y) (- nx x))] - (values - (* tile-size (- x bounds.min.x)) - (* tile-size (- y bounds.min.y)) - angle))) + (if (> nx x) + (values + (* tile-size (- x bounds.min.x)) + (* tile-size (- y bounds.min.y)) + angle) + (values ; if way runs r->l, prefer label to read l->r + (* tile-size (- nx bounds.min.x)) + (* tile-size (- ny bounds.min.y)) + (+ math.pi angle))))) + (fn cairo-the-map [window]