mirror of
https://github.com/rastapasta/mapscii.git
synced 2024-11-25 01:23:58 +01:00
🔍 adding house numbers and custom label margin per layer
This commit is contained in:
parent
6fbd676a2e
commit
64b03e3422
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -1150,6 +1150,14 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "symbol",
|
||||
"id": "housenum_label",
|
||||
"paint": {
|
||||
"text-color": "#333"
|
||||
},
|
||||
"source-layer": "housenum_label"
|
||||
},
|
||||
{
|
||||
"type": "symbol",
|
||||
"id": "place_label_other",
|
||||
|
Loading…
Reference in New Issue
Block a user