From 64b03e342262f104062c51e7b5d6cd00860dd99e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Stra=C3=9Fburger?= Date: Tue, 27 Sep 2016 23:45:26 +0200 Subject: [PATCH] :mag: adding house numbers and custom label margin per layer --- src/LabelBuffer.coffee | 6 +++--- src/Termap.coffee | 2 +- styles/bright.json | 8 ++++++++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/LabelBuffer.coffee b/src/LabelBuffer.coffee index a8fc693..84f355d 100644 --- a/src/LabelBuffer.coffee +++ b/src/LabelBuffer.coffee @@ -21,18 +21,18 @@ module.exports = class LabelBuffer project: (x, y) -> [Math.floor(x/2), Math.floor(y/4)] - writeIfPossible: (text, x, y) -> + writeIfPossible: (text, x, y, margin = @margin) -> point = @project x, y if @_hasSpace text, point[0], point[1] - @tree.insert @_calculateArea text, point[0], point[1] + @tree.insert @_calculateArea text, point[0], point[1], margin else false _hasSpace: (text, x, y) -> not @tree.collides @_calculateArea text, x, y, 0 - _calculateArea: (text, x, y, margin = @margin) -> + _calculateArea: (text, x, y, margin) -> minX: x-margin minY: y-margin maxX: x+margin+text.length diff --git a/src/Termap.coffee b/src/Termap.coffee index e14cd3f..225f3e2 100644 --- a/src/Termap.coffee +++ b/src/Termap.coffee @@ -66,7 +66,7 @@ module.exports = class Termap _resizeRenderer: (cb) -> @width = (process.stdout.columns-1) >> 1 << 2 - @height = process.stdout.rows >> 2 << 4 + @height = process.stdout.rows * 4 - 8 @renderer.setSize @width, @height diff --git a/styles/bright.json b/styles/bright.json index e6b9cf7..09ec750 100644 --- a/styles/bright.json +++ b/styles/bright.json @@ -1150,6 +1150,14 @@ } } }, + { + "type": "symbol", + "id": "housenum_label", + "paint": { + "text-color": "#333" + }, + "source-layer": "housenum_label" + }, { "type": "symbol", "id": "place_label_other",