From 6fbd676a2e064a1c2f6ef06eadcf7b7a64e6ae50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Stra=C3=9Fburger?= Date: Tue, 27 Sep 2016 23:42:24 +0200 Subject: [PATCH] :thumbsup: using readline's cursorTo, thanks to @alangecker --- src/Renderer.coffee | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/Renderer.coffee b/src/Renderer.coffee index 412d9cc..fa6a5d6 100644 --- a/src/Renderer.coffee +++ b/src/Renderer.coffee @@ -16,8 +16,10 @@ module.exports = class Renderer fillPolygons: true language: 'de' - #"poi_label", "housenum_label", "water", - drawOrder: ["admin", "building", "road", "poi_label"] + labelMargin: 5 + + #"poi_label", "water", + drawOrder: ["admin", "building", "road", "place_label", "poi_label", "housenum_label"] icons: car: "🚗" @@ -39,9 +41,13 @@ module.exports = class Renderer cinema: "C" #"🎦" layers: - housenum_label: minZoom: 1.5 + housenum_label: + minZoom: 1.5 + margin: 3 building: minZoom: 3.8 - poi_label: minZoom: 3 + poi_label: + minZoom: 3 + margin: 5 isDrawing: false lastDrawAt: 0 @@ -76,6 +82,8 @@ module.exports = class Renderer @canvas.translate @view[0], @view[1] @_drawLayers() + + process.stdout.cursorTo 0, 0 @canvas.print() @isDrawing = false @@ -141,7 +149,7 @@ module.exports = class Renderer for points in toDraw for point in points 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 notify: (text) ->