diff --git a/pkgs/maps/main.fnl b/pkgs/maps/main.fnl index 83d45c2..a8edd98 100644 --- a/pkgs/maps/main.fnl +++ b/pkgs/maps/main.fnl @@ -180,9 +180,8 @@ label.readout { (var map-surface nil) -(fn draw-onto-map-surface [surface] - (let [{ : lat : lon : zoom } app-state - { : num-tiles-x : num-tiles-y &as bounds } (map-bounds lat lon zoom) +(fn draw-onto-map-surface [surface lat lon zoom] + (let [{ : num-tiles-x : num-tiles-y &as bounds } (map-bounds lat lon zoom) road-width 14 lines []] @@ -237,14 +236,15 @@ label.readout { offset-x (- (* tile-size (- tile-x bounds.min.x)) (/ map-width 2)) offset-y (- (* tile-size (- tile-y bounds.min.y)) (/ map-height 2))] (when (not map-surface) - (let [window (widget:get_window)] + (let [window (widget:get_window) + { : lat : lon : zoom } app-state] (set map-surface (doto (window:create_similar_surface cairo.Content.COLOR (* tile-size bounds.num-tiles-x) (* tile-size bounds.num-tiles-y)) - draw-onto-map-surface)))) + (draw-onto-map-surface lat lon zoom))))) (g:set_source_surface map-surface (- offset-x) (- offset-y)) (g:set_operator cairo.Operator.SOURCE)