draw road labels always left->right
This commit is contained in:
parent
ca02f5c4fa
commit
1608d26260
@ -217,7 +217,7 @@ label.readout {
|
||||
(fn clamp-angle [rad]
|
||||
(let [circle (* 2 math.pi)]
|
||||
(if
|
||||
(< rad (- math.pi)) (clamp-angle (+ circle rad))
|
||||
(< rad (- math.pi)) (clamp-angle (+ rad circle))
|
||||
(> rad math.pi) (clamp-angle (- rad circle))
|
||||
rad)))
|
||||
|
||||
@ -246,7 +246,7 @@ label.readout {
|
||||
(g:fill)
|
||||
|
||||
(g:translate (+ (// bounds.pixels.x 2)) (+ (// bounds.pixels.y 2)))
|
||||
(g:rotate (* (/ (- app-state.orientation-target) 180) math.pi))
|
||||
(g:rotate (deg->rad (- app-state.orientation-target)))
|
||||
(g:translate (- (// bounds.pixels.x 2)) (- (// bounds.pixels.y 2)))
|
||||
|
||||
(cairo-roads g lines bounds)
|
||||
@ -266,7 +266,13 @@ label.readout {
|
||||
|
||||
(g:save)
|
||||
(g:move_to x y)
|
||||
(g:rotate angle)
|
||||
|
||||
(let [theta (clamp-angle
|
||||
(- angle (deg->rad app-state.orientation-target)))]
|
||||
(if (and (> theta 0) (< theta math.pi))
|
||||
(g:rotate (- angle (/ math.pi 2)))
|
||||
(g:rotate (- angle (* math.pi 1.5)))))
|
||||
|
||||
(g:rel_move_to (- (// w 2)) 3)
|
||||
(g:text_path n)
|
||||
(g:fill)
|
||||
|
@ -77,7 +77,7 @@
|
||||
(set biggest-n (- i 1)))))
|
||||
(let [[x y] (. points biggest-n)
|
||||
[nx ny] (. points (+ 1 biggest-n))
|
||||
angle (math.atan (- ny y) (- nx x))]
|
||||
angle (math.atan (- nx x) (- y ny))]
|
||||
[(/ (+ nx x) 2) (/ (+ ny y) 2) angle]))
|
||||
|
||||
|
||||
@ -92,7 +92,6 @@
|
||||
(icollect [_ nd (ipairs e.nodes)]
|
||||
(let [node (. nodes nd)
|
||||
(tx ty) (latlon->tile node.lat node.lon zoom)]
|
||||
;;(print e.tags.name e.id e.name node.lat node.lon)
|
||||
[ tx ty ]))]
|
||||
(tset
|
||||
lines
|
||||
|
Loading…
Reference in New Issue
Block a user