👍 using readline's cursorTo, thanks to @alangecker

This commit is contained in:
Michael Straßburger 2016-09-27 23:42:24 +02:00
parent f56b37d3b0
commit 6fbd676a2e

View File

@ -16,8 +16,10 @@ module.exports = class Renderer
fillPolygons: true fillPolygons: true
language: 'de' language: 'de'
#"poi_label", "housenum_label", "water", labelMargin: 5
drawOrder: ["admin", "building", "road", "poi_label"]
#"poi_label", "water",
drawOrder: ["admin", "building", "road", "place_label", "poi_label", "housenum_label"]
icons: icons:
car: "🚗" car: "🚗"
@ -39,9 +41,13 @@ module.exports = class Renderer
cinema: "C" #"🎦" cinema: "C" #"🎦"
layers: layers:
housenum_label: minZoom: 1.5 housenum_label:
minZoom: 1.5
margin: 3
building: minZoom: 3.8 building: minZoom: 3.8
poi_label: minZoom: 3 poi_label:
minZoom: 3
margin: 5
isDrawing: false isDrawing: false
lastDrawAt: 0 lastDrawAt: 0
@ -76,6 +82,8 @@ module.exports = class Renderer
@canvas.translate @view[0], @view[1] @canvas.translate @view[0], @view[1]
@_drawLayers() @_drawLayers()
process.stdout.cursorTo 0, 0
@canvas.print() @canvas.print()
@isDrawing = false @isDrawing = false
@ -141,7 +149,7 @@ module.exports = class Renderer
for points in toDraw for points in toDraw
for point in points for point in points
x = point[0] - text.length x = point[0] - text.length
if @labelBuffer.writeIfPossible text, x, point[1] if @labelBuffer.writeIfPossible text, x, point[1], (@config.layers[layer]?.margin or @config.labelMargin)
@canvas.text text, x, point[1], colorCode, false @canvas.text text, x, point[1], colorCode, false
notify: (text) -> notify: (text) ->